Skip to content

Commit 565baf0

Browse files
committed
Handle *0 / *1 more consistently
Avoid throwing a DES salt deprecation warning if the libc crypt implementation is used.
1 parent 32257ac commit 565baf0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ext/standard/crypt.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
9999
{
100100
char *crypt_res;
101101
zend_string *result;
102+
103+
if (salt[0] == '*' && (salt[1] == '0' || salt[1] == '1')) {
104+
return NULL;
105+
}
106+
102107
/* Windows (win32/crypt) has a stripped down version of libxcrypt and
103108
a CryptoApi md5_crypt implementation */
104109
#if PHP_USE_PHP_CRYPT_R
@@ -160,8 +165,6 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
160165
ZEND_SECURE_ZERO(output, PHP_MAX_SALT_LEN + 1);
161166
return result;
162167
}
163-
} else if (salt[0] == '*' && (salt[1] == '0' || salt[1] == '1')) {
164-
return NULL;
165168
} else {
166169
/* DES Fallback */
167170

0 commit comments

Comments
 (0)