Date: Tue, 12 Jul 2005 21:18:55 +0200 (CEST) From: Dan Lukes <dan@obluda.cz> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/83347: [ PATCH ] improper handling of malloc failures within libc's vfprintf Message-ID: <200507121918.j6CJItCe016652@kulesh.obluda.cz> Resent-Message-ID: <200507121920.j6CJK5SF075778@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 83347
>Category: bin
>Synopsis: [ PATCH ] improper handling of malloc failures within libc's vfprintf
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Jul 12 19:20:05 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Dan Lukes
>Release: FreeBSD 5.4-STABLE i386
>Organization:
Obludarium
>Environment:
System: FreeBSD 5.4-STABLE #8: Sat Jul 9 16:31:08 CEST 2005 i386
lib/libc/stdio/vfprintf.c,v 1.67.2.1 2004/08/31 05:20:43 des
>Description:
Improper handling of malloc failures within __find_arguments() - the
supporting function for vfprintf() - can cause dereferencing of NULL
>How-To-Repeat:
>Fix:
The abort() is not the best way to handle this kind of failure, but it's the
same way as other function within the same source, the __grow_type_table()
handle it. abort() seems to be better than nothink.
--- patch begins here ---
--- lib/libc/stdio/vfprintf.c.ORIG Tue Aug 31 07:20:43 2004
+++ lib/libc/stdio/vfprintf.c Tue Jul 12 21:11:09 2005
@@ -1486,6 +1486,8 @@
if (tablemax >= STATIC_ARG_TBL_SIZE) {
*argtable = (union arg *)
malloc (sizeof (union arg) * (tablemax + 1));
+ if (*argtable == NULL)
+ abort(); /* XXX handle better */
}
(*argtable) [0].intarg = 0;
--- patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507121918.j6CJItCe016652>
