summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2015-12-30 04:07:28 +0000
committerLiong Sauw Ming <ming@teluu.com>2015-12-30 04:07:28 +0000
commit9f26f500252301f9d14243861f9193b729e3204d (patch)
tree914b0a9b7455866d96602b51d2b95eccc8fb2ceb
parent9f7ea5c68a39a2fcd8e744c0d294a635aadcd702 (diff)
Re #1882 (misc): Moved checking of header count earlier when parsing generic array header in sip_parser.
Thanks to Dusan Klinec for the patch. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5223 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/src/pjsip/sip_parser.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/pjsip/src/pjsip/sip_parser.c b/pjsip/src/pjsip/sip_parser.c
index 26c46d12..378c22fa 100644
--- a/pjsip/src/pjsip/sip_parser.c
+++ b/pjsip/src/pjsip/sip_parser.c
@@ -1671,14 +1671,13 @@ static void parse_generic_array_hdr( pjsip_generic_array_hdr *hdr,
&hdr->values[hdr->count]);
hdr->count++;
- while (*scanner->curptr == ',') {
+ while ((hdr->count < PJSIP_GENERIC_ARRAY_MAX_COUNT) &&
+ (*scanner->curptr == ','))
+ {
pj_scan_get_char(scanner);
pj_scan_get( scanner, &pconst.pjsip_NOT_COMMA_OR_NEWLINE,
&hdr->values[hdr->count]);
hdr->count++;
-
- if (hdr->count >= PJSIP_GENERIC_ARRAY_MAX_COUNT)
- break;
}
end: