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

Mariusz Zaborski oshogbo at FreeBSD.org
Thu Mar 21 05:24:45 UTC 2019


Author: oshogbo
Date: Thu Mar 21 05:24:44 2019
New Revision: 345361
URL: https://svnweb.freebsd.org/changeset/base/345361

Log:
  strings: do not continue if getc or getcharacter returns EOF
  
  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 05:00:24 2019	(r345360)
+++ head/contrib/elftoolchain/strings/strings.c	Thu Mar 21 05:24:44 2019	(r345361)
@@ -300,7 +300,7 @@ getcharacter(FILE *pfile)
 
 	for(i = 0; i < encoding_size; i++) {
 		c = getc(pfile);
-		if (feof(pfile) != 0)
+		if (c == EOF)
 			return (EOF);
 		buf[i] = c;
 	}
@@ -358,7 +358,7 @@ find_strings(const char *name, FILE *pfile, off_t offs
 		memset(obuf, 0, min_len + 1);
 		for(i = 0; i < min_len; i++) {
 			c = getcharacter(pfile);
-			if (c == EOF && feof(pfile) != 0)
+			if (c == EOF)
 				goto _exit1;
 			if (PRINTABLE(c)) {
 				obuf[i] = c;


More information about the svn-src-all mailing list