summaryrefslogtreecommitdiff
path: root/pjlib-util
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2013-11-04 09:05:43 +0000
committerNanang Izzuddin <nanang@teluu.com>2013-11-04 09:05:43 +0000
commitaf9aacf4ba888d6476600c486b6d69a4d269c000 (patch)
tree1abdf25f8e1618410c741c77debaccecf3d1bdae /pjlib-util
parent25bc6b7d6ccfdeecf4595cd9aee2847895276e2a (diff)
Fix #1709: Fixed scanner in processing escaped quote right after quote begin.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4641 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib-util')
-rw-r--r--pjlib-util/src/pjlib-util/scanner.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/pjlib-util/src/pjlib-util/scanner.c b/pjlib-util/src/pjlib-util/scanner.c
index f31a19f5..97230f55 100644
--- a/pjlib-util/src/pjlib-util/scanner.c
+++ b/pjlib-util/src/pjlib-util/scanner.c
@@ -383,21 +383,17 @@ PJ_DEF(void) pj_scan_get_quotes(pj_scanner *scanner,
/* check that no backslash character precedes the end_quote. */
if (*s == end_quote[qpair]) {
if (*(s-1) == '\\') {
- if (s-2 == scanner->begin) {
+ char *q = s-2;
+ char *r = s-2;
+
+ while (r != scanner->begin && *r == '\\') {
+ --r;
+ }
+ /* break from main loop if we have odd number of backslashes */
+ if (((unsigned)(q-r) & 0x01) == 1) {
break;
- } else {
- char *q = s-2;
- char *r = s-2;
-
- while (r != scanner->begin && *r == '\\') {
- --r;
- }
- /* break from main loop if we have odd number of backslashes */
- if (((unsigned)(q-r) & 0x01) == 1) {
- break;
- }
- ++s;
}
+ ++s;
} else {
/* end_quote is not preceeded by backslash. break now. */
break;