diff --git a/modules/database/src/ioc/dbStatic/dbLex.l b/modules/database/src/ioc/dbStatic/dbLex.l index dd9dc8987..4d961975b 100644 --- a/modules/database/src/ioc/dbStatic/dbLex.l +++ b/modules/database/src/ioc/dbStatic/dbLex.l @@ -20,10 +20,11 @@ bareword [a-zA-Z0-9_\-+:.\[\]<>;] punctuation [:,\[\]{}] normalchar [^"\\\0-\x1f] barechar [a-zA-Z0-9_\-+.] -escapedchar ({backslash}["\\/bfnrt]) +escapedchar ({backslash}[^ux1-9]) hexdigit [0-9a-fA-F] +latinchar ({backslash}"x"{hexdigit}{2}) unicodechar ({backslash}"u"{hexdigit}{4}) -jsonchar ({normalchar}|{escapedchar}|{unicodechar}) +jsonchar ({normalchar}|{escapedchar}|{latinchar}|{unicodechar}) jsondqstr ({doublequote}{jsonchar}*{doublequote}) sign ([+-]?) diff --git a/modules/database/src/ioc/dbStatic/dbLexRoutines.c b/modules/database/src/ioc/dbStatic/dbLexRoutines.c index 2bc429479..1ec804441 100644 --- a/modules/database/src/ioc/dbStatic/dbLexRoutines.c +++ b/modules/database/src/ioc/dbStatic/dbLexRoutines.c @@ -1172,12 +1172,14 @@ static void dbRecordField(char *name,char *value) yyerror(NULL); return; } + if (*value == '"') { /* jsonSTRING values still have their quotes */ value++; value[strlen(value) - 1] = 0; + dbTranslateEscape(value, value); /* in-place; safe & legal */ } - dbTranslateEscape(value, value); /* in-place; safe & legal */ + status = dbPutString(pdbentry,value); if (status) { char msg[128]; @@ -1203,12 +1205,14 @@ static void dbRecordInfo(char *name, char *value) if (duplicate) return; ptempListNode = (tempListNode *)ellFirst(&tempList); pdbentry = ptempListNode->item; + if (*value == '"') { /* jsonSTRING values still have their quotes */ value++; value[strlen(value) - 1] = 0; + dbTranslateEscape(value, value); /* in-place; safe & legal */ } - dbTranslateEscape(value, value); /* yuck: in-place, but safe */ + status = dbPutInfo(pdbentry,name,value); if (status) { epicsPrintf("Can't set \"%s\" info \"%s\" to \"%s\"\n",