mirror of
https://git.disroot.org/80486DX2-66/polonium.git
synced 2024-12-25 14:49:50 +05:30
corrupter.c: allocate correct amount of heap memory
This commit is contained in:
parent
a83b9c3c32
commit
9e9ac7ce3c
@ -132,8 +132,10 @@ Corrupter_Result corrupt_file(Corrupter_Param* param) {
|
||||
|
||||
rewind(file);
|
||||
|
||||
size_t file_size = end - start;
|
||||
|
||||
// allocate memory for the file content
|
||||
byte* buffer = malloc(end);
|
||||
byte* buffer = malloc(file_size * sizeof(byte));
|
||||
|
||||
if (buffer == NULL) {
|
||||
PERROR_MACRO("malloc");
|
||||
@ -156,7 +158,7 @@ Corrupter_Result corrupt_file(Corrupter_Param* param) {
|
||||
}
|
||||
|
||||
// output data to result
|
||||
result.file_size = end - start;
|
||||
result.file_size = file_size;
|
||||
|
||||
// initialize the PRNG
|
||||
mt_seed(param->seed);
|
||||
|
Loading…
Reference in New Issue
Block a user