Skip to content

Commit

Permalink
In the UTF-8 branch of crypt() the extra \0 byte is required,
Browse files Browse the repository at this point in the history
found by Marc Lehmann.

p4raw-id: //depot/perl@14085
  • Loading branch information
jhi committed Jan 4, 2002
1 parent 4eba7d2 commit 5911668
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pp.c
Expand Up @@ -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);
Expand Down

0 comments on commit 5911668

Please sign in to comment.