Re: wrong sources

2008-09-20 Thread Paul Mundt
[ 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;
}
 
___
uClibc mailing list
uClibc@uclibc.org
http://busybox.net/cgi-bin/mailman/listinfo/uclibc


Re: wrong sources

2008-09-20 Thread Paul Mundt
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;
}
 
___
uClibc mailing list
uClibc@uclibc.org
http://busybox.net/cgi-bin/mailman/listinfo/uclibc