Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Mar 2019 06:31:14 +0000 (UTC)
From:      Mariusz Zaborski <oshogbo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345364 - head/contrib/elftoolchain/strings
Message-ID:  <201903210631.x2L6VEmE036468@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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');



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903210631.x2L6VEmE036468>