summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorChip Salzenberg <chip@perl.com>1997-04-30 17:27:58 +1200
committerChip Salzenberg <chip@atlantic.net>1997-05-01 00:00:00 +1200
commitbedebaa5d034917d531c5bc8c9415a048a98bf02 (patch)
tree9a8c03eee40237326349ef71dda30ec4771f555e /util.c
parent878e08dfd37ef18d0471607a99b747ae9fd31e93 (diff)
downloadperl-bedebaa5d034917d531c5bc8c9415a048a98bf02.tar.gz
Fix NUL-termination bug in delimcpy()
Diffstat (limited to 'util.c')
-rw-r--r--util.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/util.c b/util.c
index 2ee9c0ef90..fc245836d0 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;
}