stas                                     Sun, 31 Jul 2011 21:47:03 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=314001

Log:
fix salt truncation bug in sha256

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c
    U   php/php-src/branches/PHP_5_4/ext/standard/crypt_sha256.c
    U   php/php-src/trunk/ext/standard/crypt_sha256.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c    2011-07-31 
21:17:50 UTC (rev 314000)
+++ php/php-src/branches/PHP_5_3/ext/standard/crypt_sha256.c    2011-07-31 
21:47:03 UTC (rev 314001)
@@ -398,7 +398,7 @@
                char *tmp = (char *) alloca(salt_len + 1 + 
__alignof__(uint32_t));
                salt = copied_salt =
                memcpy(tmp + __alignof__(uint32_t) - (tmp - (char *) 0) % 
__alignof__ (uint32_t), salt, salt_len);
-               tmp[salt_len] = 0;
+               copied_salt[salt_len] = 0;
        }

        /* Prepare for the real work.  */

Modified: php/php-src/branches/PHP_5_4/ext/standard/crypt_sha256.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/standard/crypt_sha256.c    2011-07-31 
21:17:50 UTC (rev 314000)
+++ php/php-src/branches/PHP_5_4/ext/standard/crypt_sha256.c    2011-07-31 
21:47:03 UTC (rev 314001)
@@ -398,7 +398,7 @@
                char *tmp = (char *) alloca(salt_len + 1 + 
__alignof__(uint32_t));
                salt = copied_salt =
                memcpy(tmp + __alignof__(uint32_t) - (tmp - (char *) 0) % 
__alignof__ (uint32_t), salt, salt_len);
-               tmp[salt_len] = 0;
+               copied_salt[salt_len] = 0;
        }

        /* Prepare for the real work.  */

Modified: php/php-src/trunk/ext/standard/crypt_sha256.c
===================================================================
--- php/php-src/trunk/ext/standard/crypt_sha256.c       2011-07-31 21:17:50 UTC 
(rev 314000)
+++ php/php-src/trunk/ext/standard/crypt_sha256.c       2011-07-31 21:47:03 UTC 
(rev 314001)
@@ -398,7 +398,7 @@
                char *tmp = (char *) alloca(salt_len + 1 + 
__alignof__(uint32_t));
                salt = copied_salt =
                memcpy(tmp + __alignof__(uint32_t) - (tmp - (char *) 0) % 
__alignof__ (uint32_t), salt, salt_len);
-               tmp[salt_len] = 0;
+               copied_salt[salt_len] = 0;
        }

        /* Prepare for the real work.  */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to