mirror of https://github.com/thesofproject/sof.git
file_simple: Allocate correct buffer size for writing sections out
The original size given to the "calloc" call did not account for the necessity to pad section sizes to a multiple of 4 bytes. As such, every time we wrote a section that did not have a size multiple of 4 we would overflow the allocated buffer. Fix the calloc call to account for that padding requirement. Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
This commit is contained in:
parent
1ea1327b9c
commit
649b0a6790
|
@ -71,7 +71,7 @@ static int write_block(struct image *image, struct manifest_module *module,
|
|||
return file_error("Write header failed", image->out_file);
|
||||
|
||||
/* alloc data data */
|
||||
buffer = calloc(1, section->size);
|
||||
buffer = calloc(1, block.size);
|
||||
if (!buffer)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
Loading…
Reference in New Issue