svn commit: r345364 - head/contrib/elftoolchain/strings

Mariusz Zaborski oshogbo at FreeBSD.org
Thu Mar 21 06:31:15 UTC 2019


Author: oshogbo
Date: Thu Mar 21 06:31:14 2019
New Revision: 345364
URL: https://svnweb.freebsd.org/changeset/base/345364

Log:
  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

Modified:
  head/contrib/elftoolchain/strings/strings.c

Modified: head/contrib/elftoolchain/strings/strings.c
==============================================================================
--- head/contrib/elftoolchain/strings/strings.c	Thu Mar 21 06:27:58 2019	(r345363)
+++ head/contrib/elftoolchain/strings/strings.c	Thu Mar 21 06:31:14 2019	(r345364)
@@ -402,13 +402,13 @@ find_strings(const char *name, FILE *pfile, off_t offs
 					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');


More information about the svn-src-head mailing list