diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-11-29 12:34:50 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-11-29 12:34:50 +0100 |
commit | 480c7e5dfbddafa763f241aecfe3831d2b3dfca5 (patch) | |
tree | d2f2beac8b1b90e10a3994bf72180dc1445b3458 /libbb | |
parent | c1005355718055983912ebdd79357b11894e0958 (diff) | |
download | busybox-w32-480c7e5dfbddafa763f241aecfe3831d2b3dfca5.tar.gz busybox-w32-480c7e5dfbddafa763f241aecfe3831d2b3dfca5.tar.bz2 busybox-w32-480c7e5dfbddafa763f241aecfe3831d2b3dfca5.zip |
libbb: @ in "\x3@" is not a valid hex digit
function old new delta
bb_process_escape_sequence 134 141 +7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/process_escape_sequence.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libbb/process_escape_sequence.c b/libbb/process_escape_sequence.c index 59d0d3ea8..11adbfcea 100644 --- a/libbb/process_escape_sequence.c +++ b/libbb/process_escape_sequence.c | |||
@@ -41,8 +41,16 @@ char FAST_FUNC bb_process_escape_sequence(const char **ptr) | |||
41 | unsigned d = (unsigned char)(*q) - '0'; | 41 | unsigned d = (unsigned char)(*q) - '0'; |
42 | #else | 42 | #else |
43 | unsigned d = (unsigned char)_tolower(*q) - '0'; | 43 | unsigned d = (unsigned char)_tolower(*q) - '0'; |
44 | if (d >= 10) | 44 | if (d >= 10) { |
45 | d += ('0' - 'a' + 10); | 45 | //d += ('0' - 'a' + 10); |
46 | /* The above would maps 'A'-'F' and 'a'-'f' to 10-15, | ||
47 | * however, some chars like '@' would map to 9 < base. | ||
48 | * Do not allow that, map invalid chars to N > base: | ||
49 | */ | ||
50 | d += ('0' - 'a'); | ||
51 | if ((int)d >= 0) | ||
52 | d += 10; | ||
53 | } | ||
46 | #endif | 54 | #endif |
47 | if (d >= base) { | 55 | if (d >= base) { |
48 | if (WANT_HEX_ESCAPES && base == 16) { | 56 | if (WANT_HEX_ESCAPES && base == 16) { |