Skip to content
Snippets Groups Projects
Commit ade8b1b2 authored by Jo-Philipp Wich's avatar Jo-Philipp Wich
Browse files

utils: fix segfault in iwinfo_hardware_id_from_mtd()


Signed-off-by: default avatarJo-Philipp Wich <jow@openwrt.org>
parent e8a1e7d2
No related branches found
No related tags found
No related merge requests found
......@@ -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\"")))
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment