[PATCH] Fix __register_printf_function
Jakub Jelinek
jakub@redhat.com
Sat Apr 5 00:09:00 GMT 2003
Hi!
Using uninited memory is bad idea, sorry.
2003-04-05 Jakub Jelinek <jakub@redhat.com>
* stdio-common/reg-printf.c (__register_printf_function): Calloc
instead of malloc __printf_arginfo_table and __printf_function_table.
Reported by John Reiser <jreiser@BitWagon.com>.
--- libc/stdio-common/reg-printf.c.jj 2002-11-05 17:12:55.000000000 -0500
+++ libc/stdio-common/reg-printf.c 2003-04-04 19:04:45.000000000 -0500
@@ -46,7 +46,7 @@ __register_printf_function (spec, conver
if (__printf_function_table == NULL)
{
__printf_arginfo_table = (printf_arginfo_function **)
- malloc ((UCHAR_MAX + 1) * sizeof (void *) * 2);
+ calloc ((UCHAR_MAX + 1), sizeof (void *) * 2);
if (__printf_arginfo_table == NULL)
return -1;
__printf_function_table = (printf_function **)
Jakub
More information about the Libc-hacker
mailing list