cvs: php4 /ext/standard pack.c
| From: | Stanislav Malyshev | Date: | Sun, 10 Sep 2000 13:34:03 +0000 |
| Subject: | cvs: php4 /ext/standard pack.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1683@lists.php.net to get a copy of this message | ||
stas Sun Sep 10 06:34:03 2000 EDT
Modified files:
/php4/ext/standard pack.c
Log:
Fix pack() function reading string beyond the end
Index: php4/ext/standard/pack.c
diff -u php4/ext/standard/pack.c:1.24 php4/ext/standard/pack.c:1.25
--- php4/ext/standard/pack.c:1.24 Sun Sep 10 04:03:32 2000
+++ php4/ext/standard/pack.c Sun Sep 10 06:34:03 2000
@@ -15,7 +15,7 @@
| Authors: Chris Schneider <cschneid@relog.ch> |
+----------------------------------------------------------------------+
*/
-/* $Id: pack.c,v 1.24 2000/09/10 11:03:32 stas Exp $ */
+/* $Id: pack.c,v 1.25 2000/09/10 13:34:03 stas Exp $ */
#include "php.h"
@@ -302,6 +302,10 @@
convert_to_string_ex(val);
v = (*val)->value.str.val;
outputpos--;
+ if(arg > (*val)->value.str.len) {
+ php_error(E_WARNING,"pack type %c: not enough characters in string",code);
+ arg = (*val)->value.str.len;
+ }
while (arg-- > 0) {
char n = *(v++);