cvs: php4 /ext/mcrypt mcrypt.c
| From: | Zeev Suraski | Date: | Tue, 10 Jul 2001 12:57:28 +0000 |
| Subject: | cvs: php4 /ext/mcrypt mcrypt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-6144@lists.php.net to get a copy of this message | ||
zeev Tue Jul 10 08:57:28 2001 EDT
Modified files:
/php4/ext/mcrypt mcrypt.c
Log:
Fix a couple of buffer overflows in mcrypt.c
Index: php4/ext/mcrypt/mcrypt.c
diff -u php4/ext/mcrypt/mcrypt.c:1.54 php4/ext/mcrypt/mcrypt.c:1.55
--- php4/ext/mcrypt/mcrypt.c:1.54 Wed Jun 6 09:05:46 2001
+++ php4/ext/mcrypt/mcrypt.c Tue Jul 10 08:57:28 2001
@@ -1251,7 +1251,7 @@
else if (count == 1) { /* only m_k_l = OK */
key_s = emalloc (key_length_sizes[0]);
memset (key_s, 0, key_length_sizes[0]);
- memcpy (key_s, Z_STRVAL_PP(key), Z_STRLEN_PP(key));
+ memcpy (key_s, Z_STRVAL_PP(key), MIN(Z_STRLEN_PP(key), key_length_sizes[0]));
use_key_length = key_length_sizes[0];
}
else { /* derterminating smallest supported key > length of requested key */
@@ -1265,7 +1265,7 @@
}
key_s = emalloc (use_key_length);
memset (key_s, 0, use_key_length);
- memcpy (key_s, Z_STRVAL_PP(key), Z_STRLEN_PP(key));
+ memcpy (key_s, Z_STRVAL_PP(key), MIN(Z_STRLEN_PP(key), use_key_length));
}
mcrypt_free (key_length_sizes);