mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] modpost: fix buffer overflow
@ 2006-03-15 14:44 Jiri Benc
  2006-03-15 14:55 ` Bernd Petrovitsch
  2006-03-15 14:57 ` Bernd Petrovitsch
  0 siblings, 2 replies; 9+ messages in thread
From: Jiri Benc @ 2006-03-15 14:44 UTC (permalink / raw)
  To: rusty; +Cc: LKML

I got SIGABRT in modpost when building a module really deeply nested in
a filesystem (path > 100 chars):

>   Building modules, stage 2.
>   MODPOST
> *** glibc detected *** scripts/mod/modpost: realloc(): invalid next size: 0x0809f588 ***
> [...]

This patch fixes that problem.

Signed-off-by: Jiri Benc <jbenc@suse.cz>

--- linux-2.6.16-rc6.orig/scripts/mod/modpost.c
+++ linux-2.6.16-rc6/scripts/mod/modpost.c
@@ -552,7 +552,7 @@ void __attribute__((format(printf, 2, 3)
 	
 	va_start(ap, fmt);
 	len = vsnprintf(tmp, SZ, fmt, ap);
-	if (buf->size - buf->pos < len + 1) {
+	while (buf->size - buf->pos < len + 1) {
 		buf->size += 128;
 		buf->p = realloc(buf->p, buf->size);
 	}


-- 
Jiri Benc
SUSE Labs

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-03-16 19:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-15 14:44 [PATCH] modpost: fix buffer overflow Jiri Benc
2006-03-15 14:55 ` Bernd Petrovitsch
2006-03-15 14:57 ` Bernd Petrovitsch
2006-03-15 15:08   ` Jiri Benc
2006-03-15 15:35     ` Andreas Schwab
2006-03-15 22:51     ` Sam Ravnborg
2006-03-16 13:21       ` Jiri Benc
2006-03-16 15:46         ` Sam Ravnborg
2006-03-16 18:59         ` [PATCH] kbuild: fix buffer overflow in modpost Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®