Handle invalid hex escapes in seq

This commit is contained in:
Eirikr Hinngart 2025-05-17 00:53:05 -07:00
parent 4db99f4012
commit 487fcb4bff

View File

@ -350,8 +350,13 @@ unescape(char *orig)
*orig = c;
--cp;
continue;
case 'x': /* hexidecimal number */
case 'x': /* hexadecimal number */
cp++; /* skip 'x' */
if (!isxdigit((unsigned char)*cp)) {
--cp;
/* keep the backslash, treat 'x' literally */
continue;
}
for (i = 0, c = 0;
isxdigit((unsigned char)*cp) && i < 2;
i++, cp++) {