cvs: php4 /ext/mcrypt mcrypt.c
| From: | Derick Rethans | Date: | Fri, 18 May 2001 20:54:15 +0000 |
| Subject: | cvs: php4 /ext/mcrypt mcrypt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-5827@lists.php.net to get a copy of this message | ||
derick Fri May 18 13:54:15 2001 EDT
Modified files:
/php4/ext/mcrypt mcrypt.c
Log:
- Fix for bug #10890
@- Fixed bugs in the mcrypt extension that caused crashes (Derick)
Index: php4/ext/mcrypt/mcrypt.c
diff -u php4/ext/mcrypt/mcrypt.c:1.51 php4/ext/mcrypt/mcrypt.c:1.52
--- php4/ext/mcrypt/mcrypt.c:1.51 Thu May 17 14:27:48 2001
+++ php4/ext/mcrypt/mcrypt.c Fri May 18 13:54:15 2001
@@ -439,7 +439,7 @@
zval **mcryptind;
unsigned char *key_s, *iv_s;
char dummy[256];
- int max_key_size, iv_size;
+ int max_key_size, key_size, iv_size;
MCRYPT td;
int argc;
MCLS_FETCH();
@@ -464,7 +464,10 @@
if (Z_STRLEN_PP(key) > max_key_size) {
sprintf (dummy, "key size too large; supplied length: %d, max: %d",
Z_STRLEN_PP(key), max_key_size);
- php_error (E_NOTICE, dummy);
+ php_error (E_WARNING, dummy);
+ key_size = max_key_size;
+ } else {
+ key_size = Z_STRLEN_PP(key);
}
memcpy (key_s, Z_STRVAL_PP(key), Z_STRLEN_PP(key));
@@ -475,7 +478,7 @@
}
memcpy (iv_s, Z_STRVAL_PP(iv), iv_size);
- RETVAL_LONG (mcrypt_generic_init (td, key_s, Z_STRLEN_PP(key), iv_s));
+ RETVAL_LONG (mcrypt_generic_init (td, key_s, key_size, iv_s));
efree (iv_s);
efree (key_s);
}