diff options
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 |