public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix __register_printf_function
@ 2003-04-05  0:09 Jakub Jelinek
  2003-04-05  0:34 ` Roland McGrath
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2003-04-05  0:09 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

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

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

* Re: [PATCH] Fix __register_printf_function
  2003-04-05  0:09 [PATCH] Fix __register_printf_function Jakub Jelinek
@ 2003-04-05  0:34 ` Roland McGrath
  0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2003-04-05  0:34 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers

> 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>.

I put this in.


Thanks,
Roland

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

end of thread, other threads:[~2003-04-05  0:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-05  0:09 [PATCH] Fix __register_printf_function Jakub Jelinek
2003-04-05  0:34 ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).