From: Alan Modra Date: Tue, 31 Mar 2020 04:21:25 +0000 (+1030) Subject: tekhex: Uninitialised read X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b3b360dec78845e30e7994cd633905da5668a96c;p=binutils-gdb.git tekhex: Uninitialised read * tekhex.c (pass_over): Check is_eof before reading buffer. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bd43b676ba1..b3441335f06 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2020-03-31 Alan Modra + + * tekhex.c (pass_over): Check is_eof before reading buffer. + 2020-03-30 Nick Clifton PR binutils/pr25662 diff --git a/bfd/tekhex.c b/bfd/tekhex.c index c2834b32d0c..0001457c743 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)