iwinfo: fix crash on parsing mtd (#15807)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 41675
This commit is contained in:
Felix Fietkau 2014-07-16 18:57:23 +00:00
parent 0af20bbfc8
commit 1ecb74024b

View file

@ -182,7 +182,7 @@ int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id)
while (fgets(buf, sizeof(buf), mtd) > 0) while (fgets(buf, sizeof(buf), mtd) > 0)
{ {
if (fscanf(mtd, "mtd%d: %*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, "\"boardconfig\"") && strcmp(buf, "\"EEPROM\"") &&
strcmp(buf, "\"factory\""))) strcmp(buf, "\"factory\"")))
{ {