From: Roy Marples Date: Tue, 4 Mar 2014 10:07:15 +0000 (+0000) Subject: We should really check fscanf value here. X-Git-Tag: v6.3.2~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74dc3206549dddbfb361c8b2b5571a92310712a9;p=thirdparty%2Fdhcpcd.git We should really check fscanf value here. --- diff --git a/platform-linux.c b/platform-linux.c index ae44bbaf..9352e9f0 100644 --- a/platform-linux.c +++ b/platform-linux.c @@ -90,9 +90,10 @@ hardware_platform(char *str, size_t len) return -1; while (fscanf(fp, "%255s : ", buf) != EOF) { - if (strncmp(buf, mproc, strlen(mproc)) == 0) { - (void)fscanf(fp, "%255s", buf); - fclose(fp); + if (strncmp(buf, mproc, strlen(mproc)) == 0 && + fscanf(fp, "%255s", buf) == 1) + { + fclose(fp); return snprintf(str, len, ":%s", buf); } }