[patch 17/32] kbuild: fixdep segfault on pathological string-o-death

Chris Wright
2007-06-08T07:19:17Z

[-- Attachment #1: kbuild-fixdep-segfault-on-pathological-string-o-death.patch --]
[-- Type: text/plain, Size: 1035 bytes --]

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Andy Green <andy@warmcat.com>

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>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---
Fixes https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=241915

scripts/basic/fixdep.c | 2 ++
1 file changed, 2 insertions(+)

--- linux-2.6.20.13.orig/scripts/basic/fixdep.c
+++ linux-2.6.20.13/scripts/basic/fixdep.c
@@ -249,6 +249,8 @@ void parse_config_file(char *map, size_t
found:
if (!memcmp(q - 7, "_MODULE", 7))
q -= 7;
+ if( (q-p-7) < 0 )
+ continue;
use_config(p+7, q-p-7);
}
}

--