diff options
author | Andreas Gampe <agampe@google.com> | 2015-08-13 11:18:13 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2015-08-13 15:02:53 -0700 |
commit | b6858c83ec4effff0b3aa09517d873e2680b0973 (patch) | |
tree | b6d05601d3c7a649086e195df8217357f95e2ed7 | |
parent | bd63b542f66333c86c08d1ea7ce9dd4e2d6b9dc9 (diff) | |
download | flo-b6858c83ec4effff0b3aa09517d873e2680b0973.tar.gz |
Conninit: Check fread return value
Bug: 18632512
(cherry picked from commit 832524f54092092b7f2031f97609f3ff698de08c)
Change-Id: I47c851e98b769d0e78e9743de1bd9af0420462a4
-rw-r--r-- | conn_init/conn_init.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/conn_init/conn_init.c b/conn_init/conn_init.c index 2cb5591..08759b5 100644 --- a/conn_init/conn_init.c +++ b/conn_init/conn_init.c @@ -29,7 +29,6 @@ static int wifi_check_qcom_cfg_files() // Read MAC String FILE *fp = NULL; - int n = 0; fp = fopen("/persist/wifi/.macaddr", "r"); if ( fp == NULL ) { @@ -38,8 +37,13 @@ static int wifi_check_qcom_cfg_files() } else { - n = fread(macAddress, 12, 1, fp); + int n = fread(macAddress, 12, 1, fp); fclose(fp); + if (n != 12) { + memset(macAddress, 0, 13); + wfc_util_qcom_check_config((unsigned char *)macAddress); + return 0; + } // Write MAC String wfc_util_atoh( macAddress, 12, (unsigned char *)hex, 6); |