From 43c64fa18fc423b0f42a9361aaff931eeec63902 Mon Sep 17 00:00:00 2001 From: Jeremy Maitin-Shepard Date: Mon, 28 Apr 2008 19:11:00 -0400 Subject: [PATCH] spawn-process-helper.c: avoid the use of unportable strnlen --- spawn-process-helper.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spawn-process-helper.c b/spawn-process-helper.c index c117bf8..3663691 100644 --- a/spawn-process-helper.c +++ b/spawn-process-helper.c @@ -74,8 +74,11 @@ char *read_all(int fd, int max_bytes, int *bytes_read) { */ char *next_term(char **buffer, int *len) { char *p = *buffer; - int x = strnlen(p, *len); - if (x == *len) + int x = 0; + int max_len = *len; + while (x < max_len && p[x]) + ++x; + if (x == max_len) fail("error parsing"); *buffer += x + 1; *len -= (x + 1); -- 2.11.4.GIT