Message ID | 20180122105346.15367-1-w.bumiller@proxmox.com |
---|---|
State | Accepted, archived |
Delegated to: | stephen hemminger |
Headers | show |
Series | [iproute2] tc/lexer: let quotes actually start strings | expand |
On Mon, 22 Jan 2018 11:53:46 +0100 Wolfgang Bumiller <w.bumiller@proxmox.com> wrote: > The lexer will go with the longest match, so previously > the starting double quotes of a string would be swallowed by > the [^ \t\r\n()]+ pattern leaving the user no way to > actually use strings with escape sequences. > Fix this by not allowing this case to start with double > quotes. > > Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> > --- This is the same patch you posted earlier. It looked fine, just that it needs some time for people on mailing list to review.
On Mon, 22 Jan 2018 11:53:46 +0100 Wolfgang Bumiller <w.bumiller@proxmox.com> wrote: > The lexer will go with the longest match, so previously > the starting double quotes of a string would be swallowed by > the [^ \t\r\n()]+ pattern leaving the user no way to > actually use strings with escape sequences. > Fix this by not allowing this case to start with double > quotes. > > Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Looks good, applied. Don't think ematch is that widely used; or someone would have noticed.
diff --git a/tc/emp_ematch.l b/tc/emp_ematch.l index dc106759..d7a99304 100644 --- a/tc/emp_ematch.l +++ b/tc/emp_ematch.l @@ -137,7 +137,7 @@ ")" { return yylval.i = *yytext; } -[^ \t\r\n()]+ { +[^" \t\r\n()][^ \t\r\n()]* { yylval.b = bstr_alloc(yytext); if (yylval.b == NULL) return ERROR;
The lexer will go with the longest match, so previously the starting double quotes of a string would be swallowed by the [^ \t\r\n()]+ pattern leaving the user no way to actually use strings with escape sequences. Fix this by not allowing this case to start with double quotes. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> --- (Resent as separate thread) tc/emp_ematch.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)