From 0cbacacba35ac4aeaad8fb5b0a5d67577c94edc6 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 15 Nov 2006 17:44:01 +0000 Subject: [PATCH] gst/rtsp/rtspconnection.c: Don't set a data pointer to NULL and a size > 0 when we deal with empty packets. Original commit message from CVS: * gst/rtsp/rtspconnection.c: (read_body): Don't set a data pointer to NULL and a size > 0 when we deal with empty packets. * gst/rtsp/rtspmessage.c: (rtsp_message_new_response), (rtsp_message_init_response), (rtsp_message_init_data), (rtsp_message_unset), (rtsp_message_free), (rtsp_message_take_body): Check that we can't create invalid empty packets. --- ChangeLog | 12 ++++++++++++ gst/rtsp/rtspconnection.c | 4 +++- gst/rtsp/rtspmessage.c | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4ca118c..3c75dd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-11-15 Wim Taymans + + * gst/rtsp/rtspconnection.c: (read_body): + Don't set a data pointer to NULL and a size > 0 when we deal + with empty packets. + + * gst/rtsp/rtspmessage.c: (rtsp_message_new_response), + (rtsp_message_init_response), (rtsp_message_init_data), + (rtsp_message_unset), (rtsp_message_free), + (rtsp_message_take_body): + Check that we can't create invalid empty packets. + 2006-11-15 Tim-Philipp Müller Patch by: Mark Nauwelaerts diff --git a/gst/rtsp/rtspconnection.c b/gst/rtsp/rtspconnection.c index a0817f9..848f502 100644 --- a/gst/rtsp/rtspconnection.c +++ b/gst/rtsp/rtspconnection.c @@ -588,8 +588,10 @@ read_body (RTSPConnection * conn, glong content_length, RTSPMessage * msg) RTSP_CHECK (rtsp_connection_read (conn, body, content_length), read_error); + content_length += 1; + done: - rtsp_message_take_body (msg, (guint8 *) body, content_length + 1); + rtsp_message_take_body (msg, (guint8 *) body, content_length); return RTSP_OK; diff --git a/gst/rtsp/rtspmessage.c b/gst/rtsp/rtspmessage.c index 333661d..515ccb4 100644 --- a/gst/rtsp/rtspmessage.c +++ b/gst/rtsp/rtspmessage.c @@ -219,6 +219,7 @@ RTSPResult rtsp_message_take_body (RTSPMessage * msg, guint8 * data, guint size) { g_return_val_if_fail (msg != NULL, RTSP_EINVAL); + g_return_val_if_fail (data != NULL || size == 0, RTSP_EINVAL); if (msg->body) g_free (msg->body); -- 2.7.4