From: Jouni Malinen Date: Mon, 21 Dec 2009 21:17:53 +0000 (+0200) Subject: Check fread return value X-Git-Tag: hostap_0_7_1~255 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a698d28415e9d510321954673b4a76b862b4066d;p=thirdparty%2Fhostap.git Check fread return value --- diff --git a/src/utils/os_internal.c b/src/utils/os_internal.c index 7b74bbf4a..5260e2321 100644 --- a/src/utils/os_internal.c +++ b/src/utils/os_internal.c @@ -206,7 +206,12 @@ char * os_readfile(const char *name, size_t *len) return NULL; } - fread(buf, 1, *len, f); + if (fread(buf, 1, *len, f) != *len) { + fclose(f); + os_free(buf); + return NULL; + } + fclose(f); return buf;