From fa618052fde57cf707a89394f23934dd5512a8ee Mon Sep 17 00:00:00 2001 From: oshogbo Date: Thu, 21 Mar 2019 06:31:14 +0000 Subject: [PATCH] In case of ENCODING_8BIT the EOF code will be pass to putchar. EOF check should be done before (uint8_t)c > 127 test. Reported by: cem --- contrib/elftoolchain/strings/strings.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/elftoolchain/strings/strings.c b/contrib/elftoolchain/strings/strings.c index b4121051676..f5bcebb8145 100644 --- a/contrib/elftoolchain/strings/strings.c +++ b/contrib/elftoolchain/strings/strings.c @@ -402,13 +402,13 @@ find_strings(const char *name, FILE *pfile, off_t offset, off_t size) break; c = getcharacter(pfile); cur_off += encoding_size; + if (!PRINTABLE(c) || c == EOF) + break; if (encoding == ENCODING_8BIT && (uint8_t)c > 127) { putchar(c); continue; } - if (!PRINTABLE(c) || c == EOF) - break; putchar(c); } putchar('\n'); -- 2.45.0