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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to