Skip to content

Commit 6827f15

Browse files
author
marcel
committed
Fix out-of-bounds read in SIP parameter escape handling
The escape handler in VP_PVALUE_QUOTED checked for NUL terminator after advancing the cursor, but the parser is bounded by an end pointer, not NUL. A backslash at the last position would dereference past the buffer. Check bounds against end pointer before incrementing.
1 parent 67f94c9 commit 6827f15

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/sip/parse_common.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,11 @@ static int _parse_gen_params(list<sip_avp*>* params, const char** c,
256256
break;
257257

258258
case '\\':
259-
if(!*(++(*c))){
259+
if(*c + 1 >= end){
260260
DBG("Escape char in quoted str at EoT!!!\n");
261261
return MALFORMED_SIP_MSG;
262262
}
263+
++(*c);
263264
break;
264265
}
265266
break;

0 commit comments

Comments
 (0)