com php-src: Fixed bug #67512: NEWS ext/standard/crypt.c
| From: | Nikita Popov | Date: | Fri, 25 Mar 2016 19:18:46 +0000 |
| Subject: | com php-src: Fixed bug #67512: NEWS ext/standard/crypt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91481@lists.php.net to get a copy of this message | ||
Commit: 54da966883bacf28808e26eeda48fe38e21b118e
Author: Nikita Popov <nikic@php.net> Fri, 25 Mar 2016 20:18:46 +0100
Parents: c4681ec8e10b365a83bcff34a261e7c5e62dea60
Branches: PHP-5.6 PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=54da966883bacf28808e26eeda48fe38e21b118e
Log:
Fixed bug #67512
Bugs:
https://bugs.php.net/67512
Changed paths:
M NEWS
M ext/standard/crypt.c
Diff:
diff --git a/NEWS b/NEWS
index e27eef2...1f2a906 100644
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,8 @@ PHP NEWS
- Standard:
. Fixed bug #71840 (Unserialize accepts wrongly data). (Ryat, Laruence)
+ . Fixed bug #67512 (php_crypt() crashes if crypt_r() does not exist or
+ _REENTRANT is not defined). (Nikita)
31 Marc 2016, PHP 5.6.20
diff --git a/ext/standard/crypt.c b/ext/standard/crypt..c
index b7ac8d6..1b83d6e 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -236,18 +236,23 @@ PHPAPI int php_crypt(const char *password, const int pass_len, const char
*salt,
# elif defined(CRYPT_R_CRYPTD)
CRYPTD buffer;
# else
-# error Data struct used by crypt_r() is unknown. Please report.
+# error Data struct used by crypt_r() is unknown. Please report.
# endif
crypt_res = crypt_r(password, salt, &buffer);
- if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) {
- return FAILURE;
- } else {
- *result = estrdup(crypt_res);
- return SUCCESS;
- }
}
+# elif defined(HAVE_CRYPT)
+ crypt_res = crypt(password, salt);
+# else
+# error No crypt() implementation
# endif
#endif
+
+ if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) {
+ return FAILURE;
+ } else {
+ *result = estrdup(crypt_res);
+ return SUCCESS;
+ }
}
/* }}} */