FreeBSD Bugzilla – Attachment 163200 Details for
Bug 204602
parse() in boot loader interp_parse.c is too naive about quotes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
udiff of inter_parse.c
interp_parse.diff (text/plain), 1.63 KB, created by
Toomas Soome
on 2015-11-16 17:13:35 UTC
(
hide
)
Description:
udiff of inter_parse.c
Filename:
MIME Type:
Creator:
Toomas Soome
Created:
2015-11-16 17:13:35 UTC
Size:
1.63 KB
patch
obsolete
>--- /code/freebsd/head/sys/boot/common/interp_parse.c N apr 16 14:48:59 2015 >+++ /code/illumos-gate/usr/src/boot/sys/boot/common/interp_parse.c E nov 16 01:04:19 2015 >@@ -72,9 +72,15 @@ > static int > isquote(int ch) > { >- return (ch == '\'' || ch == '"'); >+ return (ch == '\''); > } > >+static int >+isdquote(int ch) >+{ >+ return (ch == '"'); >+} >+ > int > parse(int *argc, char ***argv, char *str) > { >@@ -81,11 +87,11 @@ > int ac; > char *val, *p, *q, *copy = NULL; > size_t i = 0; >- char token, tmp, quote, *buf; >+ char token, tmp, quote, dquote, *buf; > enum { STR, VAR, WHITE } state; > > ac = *argc = 0; >- quote = 0; >+ dquote = quote = 0; > if (!str || (p = copy = backslash(str)) == NULL) > return 1; > >@@ -105,9 +111,20 @@ > buf[i++] = *p++; > } else if (isquote(*p)) { > quote = quote ? 0 : *p; >- ++p; >+ if (dquote) { /* keep quote */ >+ PARSE_FAIL(i == (PARSE_BUFSIZE - 1)); >+ buf[i++] = *p++; >+ } else >+ ++p; >+ } else if (isdquote(*p)) { >+ dquote = dquote ? 0 : *p; >+ if (quote) { /* keep dquote */ >+ PARSE_FAIL(i == (PARSE_BUFSIZE - 1)); >+ buf[i++] = *p++; >+ } else >+ ++p; > } >- else if (isspace(*p) && !quote) { >+ else if (isspace(*p) && !quote && !dquote) { > state = WHITE; > if (i) { > buf[i] = '\0'; >@@ -115,7 +132,7 @@ > i = 0; > } > ++p; >- } else if (*p == '$') { >+ } else if (*p == '$' && !quote) { > token = isdelim(*(p + 1)); > if (token) > p += 2; >@@ -157,6 +174,8 @@ > break; > } > } >+ /* missing terminating ' or " */ >+ PARSE_FAIL(quote || dquote); > /* If at end of token, add it */ > if (i && state == STR) { > buf[i] = '\0';
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 204602
: 163200