From: Eugene Syromyatnikov Date: Fri, 2 Feb 2018 15:15:48 +0000 (+0100) Subject: Do not go full octal if the next char is '8' or '9' X-Git-Tag: v4.22~140 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f6f7b82d4b8520e6fcfb82787f74e373cc4a3bbd;p=strace 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. --- diff --git a/tests/print_quoted_string.c b/tests/print_quoted_string.c index 4107e256..14a1f0fb 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 6df1239a..8365f050 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);