wrong sources

Paul Mundt lethal at linux-sh.org
Sun Sep 21 02:57:46 UTC 2008


[ Adding uclibc to CC, in the future please use this instead of blindly
  CCing everyone ]

On Tue, Sep 16, 2008 at 07:52:40PM +0200, Dmytro Gorbunov wrote:
> Dear sir,
> 
> Please be informed that following code for project uClibc in file
> http://freshmeat.net/ redir/ uclibc/ 20616/ url_bz2/
> uClibc-0.9.28.1.tar.bz2/ uClibc-0.9.29/ libc/ stdio/open_memstream.  is
> wrong because memset function shouldn't take zero in 3rd parameter.
> 
> <code>
> memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0);
> </code>
> 
Thanks for the report. This does seem to be buggy at first glance. I'll
check in the attached patch unless anyone yells.

---

Index: libc/stdio/open_memstream.c
===================================================================
--- libc/stdio/open_memstream.c	(revision 23438)
+++ libc/stdio/open_memstream.c	(working copy)
@@ -107,7 +107,7 @@
 	*pos = COOKIE->pos = --leastlen;
 
 	if (leastlen > COOKIE->eof) {
-		memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0);
+		memset(COOKIE->buf + COOKIE->eof, 0, leastlen - COOKIE->eof);
 		*COOKIE->sizeloc = COOKIE->eof;
 	}
 



More information about the uClibc mailing list