SCP: Return write failure (write 0 bytes) if malloc fails in sim_fwrite on a big-endian host. Fix #204
This commit is contained in:
parent
38eaee77d9
commit
a8087ac4cc
1 changed files with 2 additions and 0 deletions
|
@ -155,6 +155,8 @@ if ((size == 0) || (count == 0)) /* check arguments */
|
|||
if (sim_end || (size == sizeof (char))) /* le or byte? */
|
||||
return fwrite (bptr, size, count, fptr); /* done */
|
||||
sim_flip = (unsigned char *)malloc(FLIP_SIZE);
|
||||
if (!sim_flip)
|
||||
return 0;
|
||||
nelem = FLIP_SIZE / size; /* elements in buffer */
|
||||
nbuf = count / nelem; /* number buffers */
|
||||
lcnt = count % nelem; /* count in last buf */
|
||||
|
|
Loading…
Add table
Reference in a new issue