Disallow "\x00"

This commit is contained in:
Dianne Skoll
2025-02-01 10:12:51 -05:00
parent 5c965e2083
commit ca56b4c90e
2 changed files with 12 additions and 2 deletions

View File

@@ -1651,7 +1651,12 @@ static int parse_expr_token(DynamicBuffer *buf, char const **in)
(*in)++;
}
c2 = (int) strtol(hexbuf, NULL, 16);
r = DBufPutc(buf, c2);
if (!c2) {
Eprint(tr("\\x00 is not a valid escape sequence"));
r = E_PARSE_ERR;
} else {
r = DBufPutc(buf, c2);
}
break;
default:
r = DBufPutc(buf, **in);

View File

@@ -697,7 +697,12 @@ int ParseQuotedString(ParsePtr p, DynamicBuffer *dbuf)
if (err) break;
}
c2 = (int) strtol(hexbuf, NULL, 16);
err = DBufPutc(dbuf, c2);
if (!c2) {
Eprint(tr("\\x00 is not a valid escape sequence"));
err = E_PARSE_ERR;
} else {
err = DBufPutc(dbuf, c2);
}
break;
default:
err = DBufPutc(dbuf, c);