public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* tekhex: Uninitialised read
@ 2020-03-31  6:26 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2020-03-31  6:26 UTC (permalink / raw)
  To: binutils

	* tekhex.c (pass_over): Check is_eof before reading buffer.

diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index c2834b32d0..0001457c74 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -525,7 +525,7 @@ pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *, char *))
 
       /* Find first '%'.  */
       is_eof = (bfd_boolean) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1);
-      while (*src != '%' && !is_eof)
+      while (!is_eof && *src != '%')
 	is_eof = (bfd_boolean) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1);
 
       if (is_eof)

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-31  6:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31  6:26 tekhex: Uninitialised read Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).