Skip to contentSkip to conversation

imsm: Fix possible segfault in check_no_platform()

PATCH Applied Mateusz Grzonka 2 participants 2 messages Jul 5, 2023 – Aug 7, 2023 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imsm: Fix possible segfault in check_no_platform()

conf_line() may return NULL, which is not handled and might cause segfault.

---
 super-intel.c | 5 +++++
 1 file changed, 5 insertions(+)
super-intel.c +5 -0
index ae0f4a8c..4ef33d31 100644
@@ -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;
Signature · 1 line
2.26.2
Applied
#1 lore raw
Quoted 7 lines · Mateusz Grzonka

conf_line() may return NULL, which is not handled and might cause segfault.

---
 super-intel.c | 5 +++++
 1 file changed, 5 insertions(+)

Applied!

Thanks,
Jes