mirror of
https://github.com/ksherlock/wdc-utils.git
synced 2024-12-13 10:29:09 +00:00
resize buffer before reading, don’t just reserve it.
This commit is contained in:
parent
8ba832d9a9
commit
5db92377d6
@ -576,7 +576,7 @@ void dump_lib(const char *name, int fd)
|
||||
std::vector<uint8_t> data;
|
||||
long count = h.l_modstart - sizeof(h);
|
||||
if (count < 0) errx(EX_DATAERR, "%s", name);
|
||||
data.reserve(count);
|
||||
data.resize(count);
|
||||
ok = read(fd, data.data(), count);
|
||||
if (ok != count) errx(EX_DATAERR, "%s truncated", name);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user