wrong sources

Paul Mundt lethal at linux-sh.org
Sun Sep 21 04:19:18 UTC 2008


On Sat, Sep 20, 2008 at 11:39:29PM -0400, Frysinger, Michael wrote:
> > 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;
> >  	}
> >  
> 
> there's actually two memset()'s iirc

So there is, I missed it as the original report only referred to a
specific instance. Anyways, here's the updated patch:

Index: libc/stdio/open_memstream.c
===================================================================
--- libc/stdio/open_memstream.c	(revision 23438)
+++ libc/stdio/open_memstream.c	(working copy)
@@ -97,7 +97,7 @@
 		if (buf) {
 			*COOKIE->bufloc = COOKIE->buf = buf;
 			COOKIE->len = leastlen;
-			memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */
+			memset(buf + COOKIE->eof, 0, leastlen - COOKIE->eof); /* 0-fill */
 		} else {
 			/* TODO: check glibc errno setting... */
 			return -1;
@@ -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