From 9f26f500252301f9d14243861f9193b729e3204d Mon Sep 17 00:00:00 2001 From: Liong Sauw Ming Date: Wed, 30 Dec 2015 04:07:28 +0000 Subject: 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 --- pjsip/src/pjsip/sip_parser.c | 7 +++---- 1 file 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: -- cgit v1.2.3