[PATCH RFC] [5/9] modpost: Fix a buffer overflow in modpost

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andi Kleen
Date: Wednesday, November 21, 2007 - 7:43 pm

When passing an file name > 1k the stack could be overflowed.
Not really a security issue, but still better plugged.


---
 scripts/mod/modpost.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux/scripts/mod/modpost.c
===================================================================
--- linux.orig/scripts/mod/modpost.c
+++ linux/scripts/mod/modpost.c
@@ -1656,7 +1656,6 @@ int main(int argc, char **argv)
 {
 	struct module *mod;
 	struct buffer buf = { };
-	char fname[SZ];
 	char *kernel_read = NULL, *module_read = NULL;
 	char *dump_write = NULL;
 	int opt;
@@ -1709,6 +1708,8 @@ int main(int argc, char **argv)
 	err = 0;
 
 	for (mod = modules; mod; mod = mod->next) {
+		char fname[strlen(mod->name) + 10];
+
 		if (mod->skip)
 			continue;
 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH RFC] [5/9] modpost: Fix a buffer overflow in modpost, Andi Kleen, (Wed Nov 21, 7:43 pm)
[PATCH RFC] [8/9] Put UDP exports into a namespace, Andi Kleen, (Wed Nov 21, 7:43 pm)
[PATCH RFC] [9/9] Add a inet namespace, Andi Kleen, (Wed Nov 21, 7:43 pm)
Re: [PATCH RFC] [1/9] Core module symbol namespaces code a ..., Christoph Hellwig, (Thu Nov 22, 4:05 am)
Re: [PATCH RFC] [1/9] Core module symbol namespaces code a ..., Christoph Hellwig, (Thu Nov 22, 4:06 am)
Re: [PATCH RFC] [1/9] Core module symbol namespaces code a ..., Arnaldo Carvalho de Melo, (Thu Nov 22, 5:01 am)
Re: [PATCH RFC] [1/9] Core module symbol namespaces code a ..., Christoph Hellwig, (Thu Nov 22, 5:03 am)
Re: [PATCH RFC] [1/9] Core module symbol namespaces code a ..., Stephen Hemminger, (Mon Nov 26, 11:25 am)
Re: [PATCH RFC] [1/9] Core module symbol namespaces code a ..., Christoph Hellwig, (Tue Nov 27, 9:33 am)
Re: [PATCH RFC] [1/9] Core module symbol namespaces code a ..., Stephen Hemminger, (Tue Nov 27, 4:00 pm)
Re: [PATCH RFC] [4/9] modpost: Fix format string warnings, Sam Ravnborg, (Mon Dec 10, 11:50 am)