From: Andi Kleen Date: Thu, 22 Nov 2007 02:43:10 +0000 (+0100) Subject: kbuild: fix a buffer overflow in modpost X-Git-Tag: v2.6.25-rc1~1164^2~64 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=666ab414fe14e8bbbe86a110437346128e1ec869;p=linux-2.6 kbuild: fix a buffer overflow in modpost When passing an file name > 1k the stack could be overflowed. Not really a security issue, but still better plugged. Signed-off-by: Andi Kleen Signed-off-by: Sam Ravnborg --- diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 404ee0d0aa..4d1c59063b 100644 --- a/scripts/mod/modpost.c +++ b/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;