From ec2d41d837c2a289ae8b72b4b45cc1b999621e35 Mon Sep 17 00:00:00 2001 From: GDR! Date: Tue, 7 Jul 2015 19:15:11 +0200 Subject: CID 122511 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)4. negative_returns: len is passed to a parameter that cannot be negative. --- util.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'util.c') diff --git a/util.c b/util.c index 5d3fefe..a2f60de 100644 --- a/util.c +++ b/util.c @@ -157,6 +157,11 @@ void* file_raw(char *path, uint32_t *size) fseek(file, 0, SEEK_END); len = ftell(file); + if(len <= 0) + { + fclose(file); + return NULL; + } data = malloc(len); if(!data) { fclose(file); -- cgit v1.2.3