aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2012-08-04 20:52:45 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2012-08-04 20:52:45 +0200
commit2cefb116d07a71cd15d2361f6e04385467e995e2 (patch)
tree567f8c17385b25558e45ea24ed7badefe19c6a59 /src
parentfe9fccd412f2bd52d483f1b8cc5fa2135438d254 (diff)
osmux: check for the maximum amount of messages in batch
This should not happen, but make sure our osmux CTR field does not wrap around.
Diffstat (limited to 'src')
-rw-r--r--src/osmux.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/osmux.c b/src/osmux.c
index fd064a4..ec43e8b 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -156,8 +156,15 @@ osmux_batch_add(struct msgb *out_msg, struct msgb *msg, struct rtp_hdr *rtph,
/* annotate current osmux header */
batch.osmuxh = osmuxh;
- } else
+ } else {
+ if (batch.osmuxh->ctr == 0x7) {
+ LOGP(DOSMUX, LOGL_ERROR, "cannot add msg=%p, "
+ "too many messages for this RTP ssrc=%u\n",
+ msg, rtph->ssrc);
+ return 0;
+ }
batch.osmuxh->ctr++;
+ }
memcpy(out_msg->tail, osmo_amr_get_payload(amrh), amr_payload_len);
msgb_put(out_msg, amr_payload_len);