From: Eugene Syromyatnikov Date: Fri, 2 Feb 2018 12:39:30 +0000 (+0100) Subject: tests: fix abbreviated octal escape check in print_quoted_memory X-Git-Tag: v4.22~141 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b4c03fcdbc666d343ef9e4e5478d39f4654e9e9;p=strace tests: fix abbreviated octal escape check in print_quoted_memory * tests/print_quoted_string.c (print_quoted_memory): Check the next character after octal-escaped one instead of the first one in the string. --- diff --git a/tests/print_quoted_string.c b/tests/print_quoted_string.c index 2894e49b..4107e256 100644 --- a/tests/print_quoted_string.c +++ b/tests/print_quoted_string.c @@ -68,7 +68,9 @@ print_quoted_memory(const void *const instr, const size_t len) char c2 = '0' + ((c >> 3) & 0x7); char c3 = '0' + (c >> 6); - if (*str >= '0' && *str <= '9') { + if (i < (len - 1) && + str[i + 1] >= '0' && + str[i + 1] <= '9') { /* Print \octal */ putchar(c3); putchar(c2);