Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932509AbWCOOol (ORCPT ); Wed, 15 Mar 2006 09:44:41 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932513AbWCOOol (ORCPT ); Wed, 15 Mar 2006 09:44:41 -0500 Received: from styx.suse.cz ([82.119.242.94]:41618 "EHLO mail.suse.cz") by vger.kernel.org with ESMTP id S932509AbWCOOok (ORCPT ); Wed, 15 Mar 2006 09:44:40 -0500 Date: Wed, 15 Mar 2006 15:44:36 +0100 From: Jiri Benc To: rusty@rustcorp.com.au Cc: LKML Subject: [PATCH] modpost: fix buffer overflow Message-ID: <20060315154436.4286d2ab@griffin.suse.cz> X-Mailer: Sylpheed-Claws 1.0.4a (GTK+ 1.2.10; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 954 Lines: 33 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 --- 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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/