Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Mar 2019 05:24:44 +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: r345361 - head/contrib/elftoolchain/strings
Message-ID:  <201903210524.x2L5OiKc002885@repo.freebsd.org>

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



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