Guest User

Untitled

a guest
Nov 19th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
  2. index 2eb4fc3..67425bc 100644
  3. --- a/ext/standard/crypt.c
  4. +++ b/ext/standard/crypt.c
  5. @@ -199,8 +199,8 @@ PHP_FUNCTION(crypt)
  6. char *output;
  7. int needed = (sizeof(sha512_salt_prefix) - 1
  8. + sizeof(sha512_rounds_prefix) +
  9. - + PHP_MAX_SALT_LEN + 1 + 43 + 1)
  10. - output = emalloc(needed * sizeof(char *));
  11. + + salt_in_len + 1 + 86 + 1);
  12. + output = emalloc(needed * sizeof(char));
  13. salt[salt_in_len] = '\0';
  14.  
  15. crypt_res = php_sha512_crypt_r(str, salt, output, needed
  16. @@ -214,7 +214,7 @@ PHP_FUNCTION(crypt)
  17. RETVAL_STRING(output, 1);
  18. }
  19.  
  20. - memset(output, 0, PHP_MAX_SALT_LEN + 1);
  21. + memset(output, 0, needed);
  22. efree(output);
  23. } else if (salt[0]=='$' && salt[1]=='5' && salt[2]=='$') {
  24. const char sha256_salt_prefix[] = "$5$";
  25. @@ -222,8 +222,8 @@ PHP_FUNCTION(crypt)
  26. char *output;
  27. int needed = (sizeof(sha256_salt_prefix) - 1
  28. + sizeof(sha256_rounds_prefix) +
  29. - + PHP_MAX_SALT_LEN + 1 + 43 + 1)
  30. - output = emalloc(needed * sizeof(char *));
  31. + + salt_in_len + 1 + 43 + 1);
  32. + output = emalloc(needed * sizeof(char));
  33. salt[salt_in_len] = '\0';
  34.  
  35. crypt_res = php_sha256_crypt_r(str, salt, output, needed
  36. @@ -237,7 +237,7 @@ PHP_FUNCTION(crypt)
  37. RETVAL_STRING(output, 1);
  38. }
  39.  
  40. - memset(output, 0, PHP_MAX_SALT_LEN + 1);
  41. + memset(output, 0, needed);
  42. efree(output);
  43. } else if (
  44. salt[0] == '$' &&
Add Comment
Please, Sign In to add comment