summaryrefslogtreecommitdiff
path: root/wai.c
diff options
context:
space:
mode:
authorCSDUMMI <csdummi.misquality@simplelogin.co>2025-05-10 18:42:55 +0200
committerCSDUMMI <csdummi.misquality@simplelogin.co>2025-05-10 18:42:55 +0200
commit2b3c39d18c4c751d36a0904f00efbf015fda7d4b (patch)
tree512be8896024ca4c4193e403f722b981e74a942e /wai.c
parent47406b5defae9d4ec6a94aeee9454514d835d42b (diff)
Fix buffer overflow error by only supplying st_size to fread once
Diffstat (limited to 'wai.c')
-rw-r--r--wai.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/wai.c b/wai.c
index 147d626..28bad13 100644
--- a/wai.c
+++ b/wai.c
@@ -338,7 +338,6 @@ int parse_module(u_char *binary, size_t len) {
return i;
}
-
int main(int argc, char **argv) {
if (argc != 2) {
@@ -356,7 +355,7 @@ int main(int argc, char **argv) {
printf("size: %ld\n", st.st_size);
unsigned char *binary = malloc(st.st_size);
- fread(binary, st.st_size, st.st_size, file);
+ fread(binary, st.st_size, 1, file);
if (parse_module(binary, st.st_size) == -1) {
printf("error :(\n");