aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-05-21 01:25:02 -0500
committerRob Landley <rob@landley.net>2020-05-21 01:25:02 -0500
commit310eefe2956725ab1ae913a2eccf3f885e321c7f (patch)
treed6859b57cc8218ee2ade7b22531a6cd5e8ae078b /lib/lib.c
parentcedf9d9525f9d0203a56358f2ff45384f2519f4d (diff)
downloadtoybox-310eefe2956725ab1ae913a2eccf3f885e321c7f.tar.gz
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).
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 71ce1fac..930f66e4 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -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];