From 6995742be031613c8cec47603854464e020127ca Mon Sep 17 00:00:00 2001 From: aymeric Date: Tue, 3 Mar 2009 14:27:36 +0000 Subject: [PATCH] fix parsing of error-code git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@285 3f6dc0c8-ddfe-455d-9043-3cd528dc4637 --- linphone/oRTP/src/stun.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linphone/oRTP/src/stun.c b/linphone/oRTP/src/stun.c index 3ba2fc141..e995e06bb 100644 --- a/linphone/oRTP/src/stun.c +++ b/linphone/oRTP/src/stun.c @@ -177,7 +177,7 @@ stunParseAtrChangeRequest( char* body, unsigned int hdrLen, StunAtrChangeReques static bool_t stunParseAtrError( char* body, unsigned int hdrLen, StunAtrError *result ) { - if ( hdrLen >= sizeof(StunAtrError) ) + if ( hdrLen < 4 || hdrLen >= 128+4) { ortp_error("stun: Incorrect size for SA_ERRORCODE"); return FALSE; @@ -845,7 +845,7 @@ static char* encodeAtrError(char* ptr, const StunAtrError *atr) { ptr = encode16(ptr, SA_ERRORCODE); - ptr = encode16(ptr, 6 + atr->sizeReason); + ptr = encode16(ptr, 4 + atr->sizeReason); ptr = encode16(ptr, atr->pad); *ptr++ = atr->errorClass; *ptr++ = atr->number;