The length of the buffer wasn't taken into account when writing to the
given buffer.
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit
cbd5e40ede4e5c6aedce9475325bdf80b7fa839b]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I14d9af77ac0a2c0d3e52c39824f3854dbbc4d58a
}
finfo.size = len;
+ } else {
+ len = finfo.size;
}
if (datablk_count) {
if (ret)
goto out;
+ if ((*actread + dest_len) > len)
+ dest_len = len - *actread;
memcpy(buf + offset + *actread, datablock, dest_len);
*actread += dest_len;
} else {
+ if ((*actread + table_size) > len)
+ table_size = len - *actread;
memcpy(buf + offset + *actread, data, table_size);
*actread += table_size;
}
data_offset += table_size;
free(data_buffer);
data_buffer = NULL;
+ if (*actread >= len)
+ break;
}
/*