svn commit: trunk/uClibc/libc/stdio

lethal at uclibc.org lethal at uclibc.org
Sun Sep 21 05:09:00 UTC 2008


Author: lethal
Date: 2008-09-20 22:08:59 -0700 (Sat, 20 Sep 2008)
New Revision: 23449

Log:
Fix up memset() argument ordering in open_memstream(). Previously
parts of the buffers were not being zeroed out as expected. Reported
by Dmytro Gorbunov <dmitro.gorbunov at gmail.com>.



Modified:
   trunk/uClibc/libc/stdio/open_memstream.c


Changeset:
Modified: trunk/uClibc/libc/stdio/open_memstream.c
===================================================================
--- trunk/uClibc/libc/stdio/open_memstream.c	2008-09-21 01:01:46 UTC (rev 23448)
+++ trunk/uClibc/libc/stdio/open_memstream.c	2008-09-21 05:08:59 UTC (rev 23449)
@@ -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-cvs mailing list