tekhex: Uninitialised read

Alan Modra amodra@gmail.com
Tue Mar 31 06:26:23 GMT 2020


	* 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



More information about the Binutils mailing list