mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fixed warning: "operation on ‘s’ may be undefined"
This commit is contained in:
parent
81a7d52814
commit
82ba5b59d9
1 changed files with 6 additions and 5 deletions
|
@ -99,7 +99,8 @@ static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi
|
|||
static void php_to64(char *s, int n) /* {{{ */
|
||||
{
|
||||
while (--n >= 0) {
|
||||
*s++ = itoa64[*s&0x3f];
|
||||
*s = itoa64[*s & 0x3f];
|
||||
s++;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -244,16 +245,16 @@ PHP_FUNCTION(crypt)
|
|||
size_t str_len, salt_in_len = 0;
|
||||
zend_string *result;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &str, &str_len, &salt_in, &salt_in_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
salt[0] = salt[PHP_MAX_SALT_LEN] = '\0';
|
||||
|
||||
/* This will produce suitable results if people depend on DES-encryption
|
||||
* available (passing always 2-character salt). At least for glibc6.1 */
|
||||
memset(&salt[1], '$', PHP_MAX_SALT_LEN - 1);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &str, &str_len, &salt_in, &salt_in_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (salt_in) {
|
||||
memcpy(salt, salt_in, MIN(PHP_MAX_SALT_LEN, salt_in_len));
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue