diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c index 5083ee4fc92f0..9e86db6020cdf 100644 --- a/ext/standard/crypt_sha256.c +++ b/ext/standard/crypt_sha256.c @@ -377,15 +377,15 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b SET_ALLOCA_FLAG(use_heap_key); SET_ALLOCA_FLAG(use_heap_salt); - if ((key - (char *) 0) % __alignof__ (uint32_t) != 0) { + if ((uintptr_t)key % __alignof__ (uint32_t) != 0) { tmp_key = (char *) do_alloca(key_len + __alignof__(uint32_t), use_heap_key); - key = copied_key = memcpy(tmp_key + __alignof__(uint32_t) - (tmp_key - (char *) 0) % __alignof__(uint32_t), key, key_len); + key = copied_key = memcpy(tmp_key + __alignof__(uint32_t) - (uintptr_t)tmp_key % __alignof__(uint32_t), key, key_len); } - if ((salt - (char *) 0) % __alignof__(uint32_t) != 0) { + if ((uintptr_t)salt % __alignof__(uint32_t) != 0) { tmp_salt = (char *) do_alloca(salt_len + 1 + __alignof__(uint32_t), use_heap_salt); salt = copied_salt = - memcpy(tmp_salt + __alignof__(uint32_t) - (tmp_salt - (char *) 0) % __alignof__ (uint32_t), salt, salt_len); + memcpy(tmp_salt + __alignof__(uint32_t) - (uintptr_t)tmp_salt % __alignof__ (uint32_t), salt, salt_len); copied_salt[salt_len] = 0; } diff --git a/ext/standard/crypt_sha512.c b/ext/standard/crypt_sha512.c index caeeff750f6ce..6ead7f2964a48 100644 --- a/ext/standard/crypt_sha512.c +++ b/ext/standard/crypt_sha512.c @@ -411,15 +411,15 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen) SET_ALLOCA_FLAG(use_heap_key); SET_ALLOCA_FLAG(use_heap_salt); - if ((key - (char *) 0) % __alignof__ (uint64_t) != 0) { + if ((uintptr_t)key % __alignof__ (uint64_t) != 0) { tmp_key = (char *) do_alloca(key_len + __alignof__ (uint64_t), use_heap_key); key = copied_key = - memcpy(tmp_key + __alignof__(uint64_t) - (tmp_key - (char *) 0) % __alignof__(uint64_t), key, key_len); + memcpy(tmp_key + __alignof__(uint64_t) - (uintptr_t)tmp_key % __alignof__(uint64_t), key, key_len); } - if ((salt - (char *) 0) % __alignof__ (uint64_t) != 0) { + if ((uintptr_t)salt % __alignof__ (uint64_t) != 0) { tmp_salt = (char *) do_alloca(salt_len + 1 + __alignof__(uint64_t), use_heap_salt); - salt = copied_salt = memcpy(tmp_salt + __alignof__(uint64_t) - (tmp_salt - (char *) 0) % __alignof__(uint64_t), salt, salt_len); + salt = copied_salt = memcpy(tmp_salt + __alignof__(uint64_t) - (uintptr_t)tmp_salt % __alignof__(uint64_t), salt, salt_len); copied_salt[salt_len] = 0; }