cvs: php4 /ext/mbstring mbstring.c

From: Date: Thu, 16 May 2002 12:31:06 +0000
Subject: cvs: php4 /ext/mbstring mbstring.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-11948@lists.php.net to get a copy of this message
pbannister Thu May 16 08:31:06 2002 EDT Modified files: /php4/ext/mbstring mbstring.c Log: Range check arguments to mb_strcut(). Test ext/mbstring/013.phpt causes a hard failure w/o this. Index: php4/ext/mbstring/mbstring.c diff -u php4/ext/mbstring/mbstring.c:1.68 php4/ext/mbstring/mbstring.c:1.69 --- php4/ext/mbstring/mbstring.c:1.68 Wed May 15 08:13:56 2002 +++ php4/ext/mbstring/mbstring.c Thu May 16 08:31:05 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mbstring.c,v 1.68 2002/05/15 12:13:56 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.69 2002/05/16 12:31:05 pbannister Exp $ */ /* * PHP4 Multibyte String module "mbstring" (currently only for Japanese) @@ -2059,6 +2059,10 @@ if (from < 0) { from = 0; } + } + if (Z_STRLEN_PP(arg1) < from) { + /* keep index within string */ + from = Z_STRLEN_PP(arg1); } /* if "length" position is negative, set it to the length @@ -2069,6 +2073,10 @@ if (len < 0) { len = 0; } + } + if (Z_STRLEN_PP(arg1) < (from + len)) { + /* limit span to characters in string */ + len = Z_STRLEN_PP(arg1) - from; } ret = mbfl_strcut(&string, &result, from, len TSRMLS_CC);

« previous php.cvs (#11948) next »