bin/83347: [ PATCH ] improper handling of malloc failures within
libc's vfprintf
Dan Lukes
dan at obluda.cz
Tue Jul 12 19:20:07 GMT 2005
>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:
More information about the freebsd-bugs
mailing list