Diff for /embedaddon/php/ext/standard/crypt.c between versions 1.1 and 1.1.1.4

version 1.1, 2012/02/21 23:48:02 version 1.1.1.4, 2014/06/15 20:03:57
Line 2 Line 2
    +----------------------------------------------------------------------+     +----------------------------------------------------------------------+
    | PHP Version 5                                                        |     | PHP Version 5                                                        |
    +----------------------------------------------------------------------+     +----------------------------------------------------------------------+
   | Copyright (c) 1997-2012 The PHP Group                                |   | Copyright (c) 1997-2014 The PHP Group                                |
    +----------------------------------------------------------------------+     +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |     | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |     | that is bundled with this package in the file LICENSE, and is        |
Line 199  PHP_FUNCTION(crypt) Line 199  PHP_FUNCTION(crypt)
                         char *output;                          char *output;
                         int needed = (sizeof(sha512_salt_prefix) - 1                          int needed = (sizeof(sha512_salt_prefix) - 1
                                                 + sizeof(sha512_rounds_prefix) + 9 + 1                                                  + sizeof(sha512_rounds_prefix) + 9 + 1
                                                + strlen(salt) + 1 + 43 + 1);                                                + salt_in_len + 1 + 86 + 1);
                        output = emalloc(needed * sizeof(char *));                        output = emalloc(needed);
                         salt[salt_in_len] = '\0';                          salt[salt_in_len] = '\0';
   
                         crypt_res = php_sha512_crypt_r(str, salt, output, needed);                          crypt_res = php_sha512_crypt_r(str, salt, output, needed);
Line 214  PHP_FUNCTION(crypt) Line 214  PHP_FUNCTION(crypt)
                                 RETVAL_STRING(output, 1);                                  RETVAL_STRING(output, 1);
                         }                          }
   
                        memset(output, 0, PHP_MAX_SALT_LEN + 1);                        memset(output, 0, needed);
                         efree(output);                          efree(output);
                 } else if (salt[0]=='$' && salt[1]=='5' && salt[2]=='$') {                  } else if (salt[0]=='$' && salt[1]=='5' && salt[2]=='$') {
                         const char sha256_salt_prefix[] = "$5$";                          const char sha256_salt_prefix[] = "$5$";
Line 222  PHP_FUNCTION(crypt) Line 222  PHP_FUNCTION(crypt)
                         char *output;                          char *output;
                         int needed = (sizeof(sha256_salt_prefix) - 1                          int needed = (sizeof(sha256_salt_prefix) - 1
                                                 + sizeof(sha256_rounds_prefix) + 9 + 1                                                  + sizeof(sha256_rounds_prefix) + 9 + 1
                                                + strlen(salt) + 1 + 43 + 1);                                                + salt_in_len + 1 + 43 + 1);
                        output = emalloc(needed * sizeof(char *));                        output = emalloc(needed);
                         salt[salt_in_len] = '\0';                          salt[salt_in_len] = '\0';
   
                         crypt_res = php_sha256_crypt_r(str, salt, output, needed);                          crypt_res = php_sha256_crypt_r(str, salt, output, needed);
Line 237  PHP_FUNCTION(crypt) Line 237  PHP_FUNCTION(crypt)
                                 RETVAL_STRING(output, 1);                                  RETVAL_STRING(output, 1);
                         }                          }
   
                        memset(output, 0, PHP_MAX_SALT_LEN + 1);                        memset(output, 0, needed);
                         efree(output);                          efree(output);
                 } else if (                  } else if (
                                 salt[0] == '$' &&                                  salt[0] == '$' &&

Removed from v.1.1  
changed lines
  Added in v.1.1.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>