* 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.
This commit is contained in:
Alan Modra 2007-10-15 02:00:56 +00:00
parent 5375ec41be
commit 615f314969
4 changed files with 34 additions and 9 deletions

View file

@ -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