diff options
author | Andreas Gampe <agampe@google.com> | 2015-08-13 22:23:13 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-08-13 22:23:13 +0000 |
commit | db892f22d2c992eca9193f4a4b1706a9e9c9f321 (patch) | |
tree | b6d05601d3c7a649086e195df8217357f95e2ed7 | |
parent | bd63b542f66333c86c08d1ea7ce9dd4e2d6b9dc9 (diff) | |
parent | b6858c83ec4effff0b3aa09517d873e2680b0973 (diff) | |
download | flo-db892f22d2c992eca9193f4a4b1706a9e9c9f321.tar.gz |
Merge "Conninit: Check fread return value"android-m-preview-2
-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); |