summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2014-11-20 13:14:14 +0100
committerSebastian Dröge <sebastian@centricular.com>2014-11-24 11:45:56 +0100
commit861874ce05ac5f1ce245dff6f8b9613549256549 (patch)
treedf4cf13ec420e7cda0c39b86be60c19637f7fef3
parent51be4effcc2adcba2e0e50ef48610c506feef387 (diff)
rtpgstpay: put 0-byte at the end of events
Put a 0-byte at the end of the event string. Does not break ABI because old depayloaders will skip the 0 byte (which is included in the length). Expect a 0-byte at the end of the event string or a ; for old payloaders. See https://bugzilla.gnome.org/show_bug.cgi?id=737591
-rw-r--r--gst/rtp/gstrtpgstdepay.c7
-rw-r--r--gst/rtp/gstrtpgstpay.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/gst/rtp/gstrtpgstdepay.c b/gst/rtp/gstrtpgstdepay.c
index a34088025..621aa4758 100644
--- a/gst/rtp/gstrtpgstdepay.c
+++ b/gst/rtp/gstrtpgstdepay.c
@@ -279,7 +279,12 @@ read_event (GstRtpGSTDepay * rtpgstdepay, guint type,
if (!read_length (rtpgstdepay, map.data, map.size, &length, &offset))
goto too_small;
- if (length == 0 || map.data[offset + length - 1] != ';')
+ if (length == 0)
+ goto invalid_buffer;
+ if (map.data[offset + length - 1] != '\0')
+ goto invalid_buffer;
+ /* backward compat, old payloader did not put 0-byte at the end */
+ if (map.data[offset + length - 1] != ';')
goto invalid_buffer;
GST_DEBUG_OBJECT (rtpgstdepay, "parsing event %s", &map.data[offset]);
diff --git a/gst/rtp/gstrtpgstpay.c b/gst/rtp/gstrtpgstpay.c
index c0a9d94d9..08794d1c1 100644
--- a/gst/rtp/gstrtpgstpay.c
+++ b/gst/rtp/gstrtpgstpay.c
@@ -483,6 +483,8 @@ gst_rtp_gst_pay_send_event (GstRtpGSTPay * rtpgstpay, guint etype,
estr = gst_structure_to_string (s);
elen = strlen (estr);
+ /* for 0 byte */
+ elen++;
outbuf = make_data_buffer (rtpgstpay, estr, elen);
GST_DEBUG_OBJECT (rtpgstpay, "sending event=%s", estr);
g_free (estr);