Browse Source

- No need to add the \0 ourselves, the estrndup in STRINGL takes care of

that for us.
PHP-5
Derick Rethans 24 years ago
parent
commit
ead7521e4d
  1. 3
      ext/standard/md5.c
  2. 3
      ext/standard/sha1.c

3
ext/standard/md5.c

@ -49,7 +49,7 @@ PHP_NAMED_FUNCTION(php_if_md5)
zend_bool raw_output = 0;
char md5str[33];
PHP_MD5_CTX context;
unsigned char digest[17];
unsigned char digest[16];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
return;
@ -60,7 +60,6 @@ PHP_NAMED_FUNCTION(php_if_md5)
PHP_MD5Update(&context, arg, arg_len);
PHP_MD5Final(digest, &context);
if (raw_output) {
digest[16] = '\0';
RETURN_STRINGL(digest, 16, 1);
} else {
make_digest(md5str, digest);

3
ext/standard/sha1.c

@ -46,7 +46,7 @@ PHP_FUNCTION(sha1)
zend_bool raw_output = 0;
char sha1str[41];
PHP_SHA1_CTX context;
unsigned char digest[21];
unsigned char digest[20];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
return;
@ -57,7 +57,6 @@ PHP_FUNCTION(sha1)
PHP_SHA1Update(&context, arg, arg_len);
PHP_SHA1Final(digest, &context);
if (raw_output) {
digest[20] = '\0';
RETURN_STRINGL(digest, 20, 1);
} else {
make_sha1_digest(sha1str, digest);

Loading…
Cancel
Save