]> granicus.if.org Git - php/commitdiff
fix termination in sha-512 too
authorStanislav Malyshev <stas@php.net>
Sun, 31 Jul 2011 23:14:04 +0000 (23:14 +0000)
committerStanislav Malyshev <stas@php.net>
Sun, 31 Jul 2011 23:14:04 +0000 (23:14 +0000)
ext/standard/crypt_sha512.c

index c3e4debe63daca595f40de9d035e5d64ecf959dd..cbc97a328c7ad8315ae8f71dd323d01bbd8d3820 100644 (file)
@@ -431,8 +431,8 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
 
        if ((salt - (char *) 0) % __alignof__ (uint64_t) != 0) {
                char *tmp = (char *) alloca(salt_len + 1 + __alignof__(uint64_t));
-               tmp[salt_len] = 0;
                salt = copied_salt = memcpy(tmp + __alignof__(uint64_t) - (tmp - (char *) 0) % __alignof__(uint64_t), salt, salt_len);
+               copied_salt[salt_len] = 0;
        }
 
        /* Prepare for the real work.  */