elfcopy: Handle multiple data descriptors properly.
The code clearly meant to resize the buffer in the case where a section was backed by multiple data descriptors. In practice this shouldn't have been a problem since libelf would return a single data descriptor for each section in a newly opened file. CID: 1262522 MFC after: 1 week Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
334f09a65b
commit
f2530c80db
@ -1137,7 +1137,7 @@ read_section(struct section *s, size_t *size)
|
||||
if (b == NULL)
|
||||
b = malloc(id->d_size);
|
||||
else
|
||||
b = malloc(sz + id->d_size);
|
||||
b = realloc(b, sz + id->d_size);
|
||||
if (b == NULL)
|
||||
err(EXIT_FAILURE, "malloc or realloc failed");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user