From 8c5150190e17e0575ba0cdbc6c2f917caa7c58a2 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Sun, 21 Sep 2008 05:08:59 +0000 Subject: Fix up memset() argument ordering in open_memstream(). Previously parts of the buffers were not being zeroed out as expected. Reported by Dmytro Gorbunov . --- libc/stdio/open_memstream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libc/stdio') 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; } -- cgit v1.2.3