From 5f12d7a3da6869bb25154d594c5d9503b33cbe6c Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 3 Sep 2014 12:33:31 +0300 Subject: [PATCH] lib/sdp: Split error handing for length and transaction id This split the handling of invalid PDU length and not matching transaction id adding proper debug logs. --- lib/sdp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/sdp.c b/lib/sdp.c index 1f199535d..2107e288f 100644 --- a/lib/sdp.c +++ b/lib/sdp.c @@ -4181,10 +4181,15 @@ int sdp_process(sdp_session_t *session) goto end; } - if (n == 0 || reqhdr->tid != rsphdr->tid || - (n != (int) (ntohs(rsphdr->plen) + sizeof(sdp_pdu_hdr_t)))) { + if (reqhdr->tid != rsphdr->tid) { t->err = EPROTO; - SDPERR("Protocol error."); + SDPERR("Protocol error: transaction id does not match"); + goto end; + } + + if (n != (int) (ntohs(rsphdr->plen) + sizeof(sdp_pdu_hdr_t))) { + t->err = EPROTO; + SDPERR("Protocol error: invalid length"); goto end; } -- 2.47.3