From a468b0f57f6983b991a0c405fe1610cd8ddfd302 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 28 Aug 2019 04:56:49 +0200 Subject: [PATCH] mgcp_codec_add: fix audio_name size check Needs to account for terminating '\0'. Change-Id: I27896beef6ffcc1cb6207daaba6c8b2b03eb513d --- src/libosmo-mgcp/mgcp_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libosmo-mgcp/mgcp_codec.c b/src/libosmo-mgcp/mgcp_codec.c index 704b7e6db..9e55ab05a 100644 --- a/src/libosmo-mgcp/mgcp_codec.c +++ b/src/libosmo-mgcp/mgcp_codec.c @@ -179,7 +179,7 @@ int mgcp_codec_add(struct mgcp_conn_rtp *conn, int payload_type, const char *aud /* Now we extract the codec subtype name, rate and channels. The latter * two are optional. If they are not present we use the safe defaults * above. */ - if (strlen(audio_name) > sizeof(audio_codec)) { + if (strlen(audio_name) >= sizeof(audio_codec)) { LOGP(DLMGCP, LOGL_ERROR, "Audio codec too long: %s\n", osmo_quote_str(audio_name, -1)); goto error; }