projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
03de77f
)
avoid depending on POSIX symbol in code used from plain C functions
author
Rich Felker
<dalias@aerifal.cx>
Tue, 17 Apr 2012 17:17:01 +0000
(13:17 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Tue, 17 Apr 2012 17:17:01 +0000
(13:17 -0400)
src/stdio/__string_read.c
patch
|
blob
|
history
diff --git
a/src/stdio/__string_read.c
b/src/stdio/__string_read.c
index 5c3728d7fc5fd0b56fd36339fb4beac7cc998798..de002fc19ba49beed1b3962379ed1c5b69116e9e 100644
(file)
--- 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);