From: Chip Salzenberg Date: Wed, 30 Apr 1997 05:27:58 +0000 (+1200) Subject: Fix NUL-termination bug in delimcpy() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bedebaa5d034917d531c5bc8c9415a048a98bf02;p=p5sagit%2Fp5-mst-13.2.git Fix NUL-termination bug in delimcpy() --- diff --git a/util.c b/util.c index 2ee9c0e..fc24583 100644 --- a/util.c +++ b/util.c @@ -302,14 +302,13 @@ I32 *retlen; from++; } } - else if (*from == delim) { - if (to < toend) - *to = '\0'; + else if (*from == delim) break; - } if (to < toend) *to++ = *from; } + if (to < toend) + *to = '\0'; *retlen = tolen; return from; }