com php-src: Fix crypt salt not being converted to b64: ext/standard/crypt.c

From: Date: Thu, 07 Jul 2016 14:32:38 +0000
Subject: com php-src: Fix crypt salt not being converted to b64: ext/standard/crypt.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-93057@lists.php.net to get a copy of this message
Commit: be3640150cb2f88d38a8d405b2bf708f04be39ef Author: Leigh <leigh@php.net> Thu, 7 Jul 2016 15:32:38 +0100 Parents: 69e7d8dcd5ccfbd4e46cdf502e7e8b0f3aa339bc Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=be3640150cb2f88d38a8d405b2bf708f04be39ef Log: Fix crypt salt not being converted to b64 Changed paths: M ext/standard/crypt.c Diff: diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 3604e19..9e097ca 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -96,11 +96,10 @@ PHP_MSHUTDOWN_FUNCTION(crypt) /* {{{ */ static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; -static void php_to64(char *s, zend_long v, int n) /* {{{ */ +static void php_to64(char *s, int n) /* {{{ */ { while (--n >= 0) { - *s++ = itoa64[v&0x3f]; - v >>= 6; + *s++ = itoa64[*s&0x3f]; } } /* }}} */ @@ -265,6 +264,7 @@ PHP_FUNCTION(crypt) if (!*salt) { strncpy(salt, "$1$", 3); php_random_bytes_throw(&salt[3], 8); + php_to64(&salt[3], 8); strncpy(&salt[11], "$", PHP_MAX_SALT_LEN - 11); salt_in_len = strlen(salt); } else {

« previous php.cvs (#93057) next »