summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-01-04 23:36:23 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-01-04 23:36:23 +0000
commit591166816e29d06350e6ec8041e206c1afa73419 (patch)
treece48e93a4241b7923f78b866dcedf02e73582841 /pp.c
parent4eba7d22051960c27a75db6011d6e5dcdae952a8 (diff)
downloadperl-591166816e29d06350e6ec8041e206c1afa73419.tar.gz
In the UTF-8 branch of crypt() the extra \0 byte is required,
found by Marc Lehmann. p4raw-id: //depot/perl@14085
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pp.c b/pp.c
index eb386eede1..8b58c167a4 100644
--- a/pp.c
+++ b/pp.c
@@ -3180,12 +3180,12 @@ PP(pp_crypt)
char *tmps = SvPV(left, len);
char *t = 0;
if (DO_UTF8(left)) {
- /* If Unicode take the crypt() of the low 8 bits
- * of the characters of the string. */
+ /* If Unicode take the crypt() of the low 8 bits of
+ * the characters of the string. Yes, we made this up. */
char *s = tmps;
char *send = tmps + len;
STRLEN i = 0;
- Newz(688, t, len, char);
+ Newz(688, t, len + 1, char);
while (s < send) {
t[i++] = utf8_to_uvchr((U8*)s, 0) & 0xFF;
s += UTF8SKIP(s);