瀏覽代碼

kbuild: scripts/basic/fixdep segfault on pathological string-o-death

build scripts: fixdep blows segfault on string CONFIG_MODULE seen

The string "CONFIG_MODULE" appearing anywhere in a source file causes
fixdep to segfault.  This string appeared in the wild in the current
mISDN sources (I think they meant CONFIG_MODULES).  But it shouldn't
segfault (esp as CONFIG_MODULE appeared in a quoted string).

Signed-off-by: Andy Green <andy@warmcat.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Andy Green 18 年之前
父節點
當前提交
04c58f8196
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      scripts/basic/fixdep.c

+ 2 - 0
scripts/basic/fixdep.c

@@ -249,6 +249,8 @@ void parse_config_file(char *map, size_t len)
 	found:
 	found:
 		if (!memcmp(q - 7, "_MODULE", 7))
 		if (!memcmp(q - 7, "_MODULE", 7))
 			q -= 7;
 			q -= 7;
+		if( (q-p-7) < 0 )
+			continue;
 		use_config(p+7, q-p-7);
 		use_config(p+7, q-p-7);
 	}
 	}
 }
 }