]> granicus.if.org Git - strace/commitdiff
Do not go full octal if the next char is '8' or '9'
authorEugene Syromyatnikov <evgsyr@gmail.com>
Fri, 2 Feb 2018 15:15:48 +0000 (16:15 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 1 Mar 2018 01:00:24 +0000 (01:00 +0000)
* 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.

tests/print_quoted_string.c
util.c

index 4107e256056364b99b9ed300211df0a8df5b42dc..14a1f0fb8d7f413c3f6d983dd81d90c9dc019181 100644 (file)
@@ -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 6df1239aa188ef035eb339b4bdca395a7d96167b..8365f050f7216c3bb71d139ccda46c137c82c5ca 100644 (file)
--- 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);