summaryrefslogtreecommitdiff
path: root/libc/stdio
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-09-21 05:08:59 +0000
committerPaul Mundt <lethal@linux-sh.org>2008-09-21 05:08:59 +0000
commit8c5150190e17e0575ba0cdbc6c2f917caa7c58a2 (patch)
tree6f9cf4dd8571c8688256bcd3a6bf872c927b9af2 /libc/stdio
parentaf64d37942aaa41bb44f07f39c314b0cba2ae79a (diff)
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@gmail.com>.
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/open_memstream.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libc/stdio/open_memstream.c b/libc/stdio/open_memstream.c
index e7b1cf435..5861017e4 100644
--- a/libc/stdio/open_memstream.c
+++ b/libc/stdio/open_memstream.c
@@ -97,7 +97,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence)
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 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence)
*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;
}