]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: Fix possible segfault in check_no_platform()
authorMateusz Grzonka <mateusz.grzonka@intel.com>
Wed, 5 Jul 2023 14:34:56 +0000 (16:34 +0200)
committerJes Sorensen <jes@trained-monkey.org>
Mon, 7 Aug 2023 21:01:54 +0000 (17:01 -0400)
conf_line() may return NULL, which is not handled and might cause
segfault.

Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
super-intel.c

index ae0f4a8c6bba07c1f0bd1640200383f0275d1601..4ef33d317482f40b30f2450a5821f848b4ff6674 100644 (file)
@@ -650,6 +650,11 @@ static int check_no_platform(void)
                char *l = conf_line(fp);
                char *w = l;
 
+               if (l == NULL) {
+                       fclose(fp);
+                       return 0;
+               }
+
                do {
                        if (strcmp(w, search) == 0)
                                no_platform = 1;