David Legault reported that unescape2() doesn't handle \0 right

because scanf("0%o") needs a 0 _and_ one or more digits. So add it to
the end of the \n translation list (where it returns the null terminator).
This commit is contained in:
Rob Landley 2020-05-21 01:25:02 -05:00
parent cedf9d9525
commit 310eefe295

View File

@ -453,7 +453,7 @@ int unescape2(char **c, int echo)
}
}
if (-1 == (idx = stridx("\\abeEfnrtv'\"?", **c))) return '\\';
if (-1 == (idx = stridx("\\abeEfnrtv'\"?0", **c))) return '\\';
++*c;
return "\\\a\b\033\033\f\n\r\t\v'\"?"[idx];