summaryrefslogtreecommitdiff
path: root/bfd/tekhex.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-08-18 08:45:12 +0100
committerNick Clifton <nickc@redhat.com>2017-08-18 08:45:12 +0100
commitde25939739ffe9a9ad7cec07a35bb2a1e430fe39 (patch)
treec7e12ad2404cac942ea6fadedbbcb5468b496464 /bfd/tekhex.c
parentdd66b39984d2b8a24b97638d65eef5cfd7dcbc5a (diff)
downloadbinutils-gdb-de25939739ffe9a9ad7cec07a35bb2a1e430fe39.tar.gz
Fix buffer overrun parsing a corrupt tekhex binary.
PR binutils/21962 * tekhex.c (getsym): Fix check for source pointer walking off the end of the input buffer.
Diffstat (limited to 'bfd/tekhex.c')
-rw-r--r--bfd/tekhex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index 1d605d5e373..cb4b624d408 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -307,7 +307,7 @@ getsym (char *dstp, char **srcp, unsigned int *lenp, char * endp)
len = hex_value (*src++);
if (len == 0)
len = 16;
- for (i = 0; i < len && src < endp; i++)
+ for (i = 0; i < len && (src + i) < endp; i++)
dstp[i] = src[i];
dstp[i] = 0;
*srcp = src + i;