diff options
author | Alan Modra <amodra@gmail.com> | 2007-10-15 02:00:56 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2007-10-15 02:00:56 +0000 |
commit | 615f314969111779bdaffaef0e00d13a0efd51f5 (patch) | |
tree | 234eaa69ef30f097b5316983ade490b64de93841 /binutils/sysdump.c | |
parent | 5375ec41bea0ede4ebb4ef8afdc5df82466b3db9 (diff) | |
download | gdb-615f314969111779bdaffaef0e00d13a0efd51f5.zip gdb-615f314969111779bdaffaef0e00d13a0efd51f5.tar.gz gdb-615f314969111779bdaffaef0e00d13a0efd51f5.tar.bz2 |
* objdump.c (print_line): Check fwrite return value.
* srconv.c (checksum, wr_tr, wr_cs): Likewise.
* sysdump.c (fillup): Return zero on getc or fread EOF. Return count
read.
Diffstat (limited to 'binutils/sysdump.c')
-rw-r--r-- | binutils/sysdump.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/binutils/sysdump.c b/binutils/sysdump.c index 6b3fbda..8387e71 100644 --- a/binutils/sysdump.c +++ b/binutils/sysdump.c @@ -119,8 +119,15 @@ fillup (unsigned char *ptr) int sum; int i; - size = getc (file) - 2; - fread (ptr, 1, size, file); + size = getc (file); + if (size == EOF + || size <= 2) + return 0; + + size -= 2; + if (fread (ptr, size, 1, file) != 1) + return 0; + sum = code + size + 2; for (i = 0; i < size; i++) @@ -132,7 +139,7 @@ fillup (unsigned char *ptr) if (dump) dh (ptr, size); - return size - 1; + return size; } static barray |