From: Rich Felker Date: Tue, 17 Apr 2012 17:17:01 +0000 (-0400) Subject: avoid depending on POSIX symbol in code used from plain C functions X-Git-Tag: v0.8.8~12 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8b57a81577980e4b440addaa8f2bbed454be2a59;p=oweals%2Fmusl.git avoid depending on POSIX symbol in code used from plain C functions --- diff --git a/src/stdio/__string_read.c b/src/stdio/__string_read.c index 5c3728d7..de002fc1 100644 --- a/src/stdio/__string_read.c +++ b/src/stdio/__string_read.c @@ -3,7 +3,9 @@ size_t __string_read(FILE *f, unsigned char *buf, size_t len) { char *src = f->cookie; - size_t k = strnlen(src, len+256); + size_t k = len+256; + char *end = memchr(src, 0, k); + if (end) k = end-src; if (k < len) len = k; memcpy(buf, src, len); f->rpos = (void *)(src+len);