summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Syromyatnikov <evgsyr@gmail.com>2018-02-02 16:15:48 +0100
committerDmitry V. Levin <ldv@altlinux.org>2018-03-01 01:00:24 +0000
commitf6f7b82d4b8520e6fcfb82787f74e373cc4a3bbd (patch)
tree8170fdf55ff45c6c63ab5560ff7280d532671249
parent2b4c03fcdbc666d343ef9e4e5478d39f4654e9e9 (diff)
downloadstrace-f6f7b82d4b8520e6fcfb82787f74e373cc4a3bbd.tar.gz
Do not go full octal if the next char is '8' or '9'
* util.c (string_quote): Change the upper limit for the next character in unabbreviated octal printing from '9' to '7'. * tests/print_quoted_string.c (print_quoted_memory): Likewise.
-rw-r--r--tests/print_quoted_string.c2
-rw-r--r--util.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/print_quoted_string.c b/tests/print_quoted_string.c
index 4107e2560..14a1f0fb8 100644
--- a/tests/print_quoted_string.c
+++ b/tests/print_quoted_string.c
@@ -70,7 +70,7 @@ print_quoted_memory(const void *const instr, const size_t len)
if (i < (len - 1) &&
str[i + 1] >= '0' &&
- str[i + 1] <= '9') {
+ str[i + 1] <= '7') {
/* Print \octal */
putchar(c3);
putchar(c2);
diff --git a/util.c b/util.c
index 6df1239aa..8365f050f 100644
--- a/util.c
+++ b/util.c
@@ -559,7 +559,7 @@ string_quote(const char *instr, char *outstr, const unsigned int size,
*s++ = '\\';
if (i + 1 < size
&& ustr[i + 1] >= '0'
- && ustr[i + 1] <= '9'
+ && ustr[i + 1] <= '7'
) {
/* Print \ooo */
*s++ = '0' + (c >> 6);