diff options
author | Xinchen Hui <laruence@gmail.com> | 2016-08-02 20:28:42 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2016-08-02 20:28:42 +0800 |
commit | 82ba5b59d9bc9f1656ea74cfaf3e4c6326957f2b (patch) | |
tree | 815c537133fa3d98931427c419bd101c92123984 /ext/standard/crypt.c | |
parent | 81a7d528148f131a7c38c9c1f1d73ec95a0d6a3c (diff) | |
download | php-git-82ba5b59d9bc9f1656ea74cfaf3e4c6326957f2b.tar.gz |
Fixed warning: "operation on āsā may be undefined"
Diffstat (limited to 'ext/standard/crypt.c')
-rw-r--r-- | ext/standard/crypt.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 9e097ca6cf..f2f778e764 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -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 { |