diff options
author | Pablo Neira Ayuso <pablo@gnumonks.org> | 2013-05-24 12:49:52 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@gnumonks.org> | 2013-05-24 12:51:02 +0200 |
commit | 390872055d5b306b55974918ee35ae5c902d7905 (patch) | |
tree | a264f90ea9c171143bbc2246bc383a93bfe6a3c6 /src/osmux.c | |
parent | af8cc087ee3da4fc8e2cfdb308be2d440992d0c6 (diff) |
osmux: nul-terminate all strings generated by _snprintf
Make sure all strings are null-terminated.
Spotted by Holger Hans Peter Freyther.
Diffstat (limited to 'src/osmux.c')
-rw-r--r-- | src/osmux.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/osmux.c b/src/osmux.c index a844372..499b5da 100644 --- a/src/osmux.c +++ b/src/osmux.c @@ -131,6 +131,7 @@ osmux_rebuild_rtp(struct osmux_out_handle *h, h->rtp_timestamp += DELTA_RTP_TIMESTAMP; osmo_rtp_snprintf(buf, sizeof(buf), out_msg); + buf[sizeof(buf)-1] = '\0'; LOGP(DLMIB, LOGL_DEBUG, "%s\n", buf); return out_msg; @@ -160,6 +161,7 @@ int osmux_xfrm_output(struct osmux_hdr *osmuxh, struct osmux_out_handle *h, continue; osmo_rtp_snprintf(buf, sizeof(buf), msg); + buf[sizeof(buf)-1] = '\0'; LOGP(DLMIB, LOGL_DEBUG, "extracted: %s\n", buf); llist_add_tail(&msg->list, list); } @@ -266,6 +268,7 @@ static struct msgb *osmux_build_batch(struct osmux_in_handle *h) int add_osmux_hdr = 0; osmo_rtp_snprintf(buf, sizeof(buf), cur); + buf[sizeof(buf)-1] = '\0'; LOGP(DLMIB, LOGL_DEBUG, "built: %s\n", buf); rtph = osmo_rtp_get_hdr(cur); |