]> granicus.if.org Git - php/commitdiff
- No need to add the \0 ourselves, the estrndup in STRINGL takes care of
authorDerick Rethans <derick@php.net>
Thu, 20 Feb 2003 06:56:37 +0000 (06:56 +0000)
committerDerick Rethans <derick@php.net>
Thu, 20 Feb 2003 06:56:37 +0000 (06:56 +0000)
  that for us.

ext/standard/md5.c
ext/standard/sha1.c

index 594a6e2303e7c0ab9aaea628a8790f4d039a4b89..1bde1f6809a8c042bf8487d762c0238c57f7725b 100644 (file)
@@ -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);
index 765f9d46f2572d714d897308aaf861f3c45d564e..77b3fbb4f93c8c768e81435dbaf7dc6b243492ad 100644 (file)
@@ -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);