This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Fix buffer overflow in srec error handling
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: binutils at sourceware dot org
- Date: Mon, 27 Oct 2014 22:42:31 +0100
- Subject: [PATCH] Fix buffer overflow in srec error handling
- Authentication-results: sourceware.org; auth=none
This patch makes sure the character passed to srec_bad_byte is never
negative.
Andreas.
PR binutils/17512
* srec.c (srec_scan): Read bytes after 'S' as unsigned.
---
bfd/srec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bfd/srec.c b/bfd/srec.c
index 9ed2080..0c473b2 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -452,7 +452,7 @@ srec_scan (bfd *abfd)
case 'S':
{
file_ptr pos;
- char hdr[3];
+ unsigned char hdr[3];
unsigned int bytes, min_bytes;
bfd_vma address;
bfd_byte *data;
--
2.1.2
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."