]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
We should really check fscanf value here.
authorRoy Marples <roy@marples.name>
Tue, 4 Mar 2014 10:07:15 +0000 (10:07 +0000)
committerRoy Marples <roy@marples.name>
Tue, 4 Mar 2014 10:07:15 +0000 (10:07 +0000)
platform-linux.c

index ae44bbafb1f2243cab0c336171c933240e2b1a00..9352e9f08ad54c1cb2ecb94aa90f1c8be6b4918b 100644 (file)
@@ -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);
                }
        }