derick          Thu Feb 20 01:56:37 2003 EDT

  Modified files:              
    /php4/ext/standard  md5.c sha1.c 
  Log:
  - No need to add the \0 ourselves, the estrndup in STRINGL takes care of
    that for us.
  
  
Index: php4/ext/standard/md5.c
diff -u php4/ext/standard/md5.c:1.30 php4/ext/standard/md5.c:1.31
--- php4/ext/standard/md5.c:1.30        Tue Feb 18 15:31:19 2003
+++ php4/ext/standard/md5.c     Thu Feb 20 01:56:37 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: md5.c,v 1.30 2003/02/18 20:31:19 derick Exp $ */
+/* $Id: md5.c,v 1.31 2003/02/20 06:56:37 derick Exp $ */
 
 /* 
  * md5.c - Copyright 1997 Lachlan Roche 
@@ -49,7 +49,7 @@
        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_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: php4/ext/standard/sha1.c
diff -u php4/ext/standard/sha1.c:1.5 php4/ext/standard/sha1.c:1.6
--- php4/ext/standard/sha1.c:1.5        Tue Feb 18 15:31:19 2003
+++ php4/ext/standard/sha1.c    Thu Feb 20 01:56:37 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: sha1.c,v 1.5 2003/02/18 20:31:19 derick Exp $ */
+/* $Id: sha1.c,v 1.6 2003/02/20 06:56:37 derick Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -46,7 +46,7 @@
        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_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);



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

Reply via email to