From 02d6ee5a7c3d7b147f2d7870a5c82e9571633fcb Mon Sep 17 00:00:00 2001 From: chenqiwu Date: Sat, 7 Sep 2019 10:29:49 +0800 Subject: [PATCH] Fix a segfault in setup_ikconfig. We add an ikconfig entry only if ent[0] != '#', it is not an advisable condition because there is a potential segfault risk if ent is gibberish, the most advisable condition is judge an ikconfig entry if start with "CONFIG_". Signed-off-by: chenqiwu --- kernel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel.c b/kernel.c index 7804aef..d023c87 100644 --- a/kernel.c +++ b/kernel.c @@ -10144,7 +10144,7 @@ static int setup_ikconfig(char *config) while (whitespace(*ent)) ent++; - if (ent[0] != '#') { + if (!strncmp(ent, "CONFIG_", strlen("CONFIG_"))) { add_ikconfig_entry(ent, &ikconfig_all[kt->ikconfig_ents++]); if (kt->ikconfig_ents == IKCONFIG_MAX) { -- 2.14.1