fix parsing of error-code

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@285 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
aymeric 2009-03-03 14:27:36 +00:00
parent 3385930e6c
commit 6995742be0

View file

@ -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;