From bc545242708372fd2fea15e7e1a8ae014c537ae5 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 24 Jan 2023 11:08:13 -0600 Subject: [PATCH] Fix bad JSON char detection in dbStatic Thanks to Dirk Zimoch for pointing this out. --- modules/database/src/ioc/dbStatic/dbLex.l | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/database/src/ioc/dbStatic/dbLex.l b/modules/database/src/ioc/dbStatic/dbLex.l index b11ace099..52f4ec31e 100644 --- a/modules/database/src/ioc/dbStatic/dbLex.l +++ b/modules/database/src/ioc/dbStatic/dbLex.l @@ -15,7 +15,8 @@ doublequote "\"" comment "#" whitespace [ \t\r\n] escape {backslash}. -stringchar [^"\n\\] +sqschar [^'\n\\] +dqschar [^"\n\\] bareword [a-zA-Z0-9_\-+:.\[\]<>;] punctuation [:,\[\]{}] @@ -84,7 +85,7 @@ static int yyreset(void) return(tokenSTRING); } -{doublequote}({stringchar}|{escape})*{doublequote} { /* quoted string */ +{doublequote}({dqschar}|{escape})*{doublequote} { /* quoted string */ yylval.Str = dbmfStrdup((char *) yytext+1); yylval.Str[strlen(yylval.Str)-1] = '\0'; return(tokenSTRING); @@ -129,14 +130,14 @@ static int yyreset(void) /* Error patterns */ -{doublequote}({stringchar}|{escape})*{newline} { +{doublequote}({dqschar}|{escape})*{newline} { yyerrorAbort("Newline in string, closing quote missing"); } -{doublequote}({stringchar}|{escape})*{doublequote} { +{doublequote}({dqschar}|{escape})*{doublequote} { yyerrorAbort("Bad character in JSON string"); } -{singlequote}({stringchar}|{escape})*{singlequote} { +{singlequote}({sqschar}|{escape})*{singlequote} { yyerrorAbort("Bad character in JSON string"); }