Skip to content

Commit 67f94c9

Browse files
author
marcel
committed
Fix #129: Strip quotes from SIP parameter values in parser
The generic SIP parameter parser (_parse_gen_params) was including the surrounding double-quotes as part of quoted parameter values. For example, boundary="myboundary" was stored as "myboundary" (with quotes) instead of myboundary (without quotes). This caused multipart MIME body parsing to fail because findNextBoundary() searched for "--\"myboundary\"" in the body instead of "--myboundary", resulting in "unexpected end-of-buffer" errors. The fix adjusts the VP_PVALUE_QUOTED state handling to skip past the opening quote when recording the value start position, and to stop before the closing quote when recording the value end position. This has no impact on other SIP parameters (tag, branch, received, rport, lr, transport) as they are always tokens and never quoted.
1 parent c1f4d4c commit 67f94c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/sip/parse_common.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static int _parse_gen_params(list<sip_avp*>* params, const char** c,
201201

202202
case '\"':
203203
st = VP_PVALUE_QUOTED;
204-
beg = *c;
204+
beg = *c + 1;
205205
break;
206206

207207
case ';':
@@ -250,7 +250,7 @@ static int _parse_gen_params(list<sip_avp*>* params, const char** c,
250250

251251
case '\"':
252252
st = VP_PARAM_SEP;
253-
avp->value.set(beg,*c+1-beg);
253+
avp->value.set(beg,*c-beg);
254254
params->push_back(avp.release());
255255
avp.reset(new sip_avp());
256256
break;

0 commit comments

Comments
 (0)