summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko2010-10-25 12:14:21 +0200
committerDenys Vlasenko2010-10-25 12:14:21 +0200
commita2d27a19197cc5ed787dc2439df0cae58053ea2c (patch)
tree75789b79f011b519793c1c4976421c310bdfccdc /libbb
parentb507cc3aceda26eff851230223a62c6fb471573c (diff)
downloadbusybox-a2d27a19197cc5ed787dc2439df0cae58053ea2c.zip
busybox-a2d27a19197cc5ed787dc2439df0cae58053ea2c.tar.gz
libbb/process_escape_sequence.c: fix recently broken handling of \\
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/process_escape_sequence.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libbb/process_escape_sequence.c b/libbb/process_escape_sequence.c
index 7b1d97f..346ecfa 100644
--- a/libbb/process_escape_sequence.c
+++ b/libbb/process_escape_sequence.c
@@ -75,8 +75,8 @@ char FAST_FUNC bb_process_escape_sequence(const char **ptr)
* Manpages tend to support coreutils way.
* Update: coreutils added support for \e on 28 Oct 2009. */
static const char charmap[] ALIGN1 = {
- 'a', 'b', 'e', 'f', 'n', 'r', 't', 'v', '\\',
- '\a', '\b', 27, '\f', '\n', '\r', '\t', '\v', '\\',
+ 'a', 'b', 'e', 'f', 'n', 'r', 't', 'v', '\\', '\0',
+ '\a', '\b', 27, '\f', '\n', '\r', '\t', '\v', '\\', '\\',
};
const char *p = charmap;
do {
@@ -84,8 +84,8 @@ char FAST_FUNC bb_process_escape_sequence(const char **ptr)
q++;
break;
}
- } while (*++p != '\\');
- /* p points to found escape char or '\',
+ } while (*++p != '\0');
+ /* p points to found escape char or NUL,
* advance it and find what it translates to.
* Note that \NUL and unrecognized sequence \z return '\'
* and leave ptr pointing to NUL or z. */