diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-06-01 06:23:14 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-06-01 06:23:14 +0200 |
commit | ade8b1b299cbd5748db1acf80dd3e9f567938371 (patch) | |
tree | 977c5cbc17ac01c38c220a0e7e7cc4ae4aba80bc /iwinfo_utils.c | |
parent | e8a1e7d224918ba23fe0cd125e70907cb31aea31 (diff) | |
download | iwinfo-ade8b1b299cbd5748db1acf80dd3e9f567938371.tar.gz |
utils: fix segfault in iwinfo_hardware_id_from_mtd()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'iwinfo_utils.c')
-rw-r--r-- | iwinfo_utils.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/iwinfo_utils.c b/iwinfo_utils.c index f4b7b58..3b993d1 100644 --- a/iwinfo_utils.c +++ b/iwinfo_utils.c @@ -177,8 +177,8 @@ int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id) FILE *mtd; uint16_t *bc; - int fd; - unsigned int len, off; + int fd, off; + unsigned int len; char buf[128]; if (!(mtd = fopen("/proc/mtd", "r"))) @@ -186,7 +186,7 @@ int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id) while (fgets(buf, sizeof(buf), mtd) != NULL) { - if (fscanf(mtd, "mtd%u: %x %*x %127s", &off, &len, buf) < 3 || + if (fscanf(mtd, "mtd%d: %x %*x %127s", &off, &len, buf) < 3 || (strcmp(buf, "\"boardconfig\"") && strcmp(buf, "\"EEPROM\"") && strcmp(buf, "\"factory\""))) { |