cvs: php4 /ext/standard reg.c
| From: | jim winstead | Date: | Sat, 05 Jan 2002 01:59:11 +0000 |
| Subject: | cvs: php4 /ext/standard reg.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-8948@lists.php.net to get a copy of this message | ||
jimw Fri Jan 4 20:59:11 2002 EDT
Modified files:
/php4/ext/standard reg.c
Log:
Be more aggressive in making sure that substring matches are valid in
ereg_replace before trying to use them.
# i could have sworn i fixed this in php3. ereg() has similar logic, i
# guess i just missed ereg_replace. fixing this lets
# ext/standard/tests/reg/012.phpt pass on my debian/unstable box
Index: php4/ext/standard/reg.c
diff -u php4/ext/standard/reg.c:1.56 php4/ext/standard/reg.c:1.57
--- php4/ext/standard/reg.c:1.56 Sun Dec 23 10:56:41 2001
+++ php4/ext/standard/reg.c Fri Jan 4 20:59:11 2002
@@ -17,7 +17,7 @@
| Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
+----------------------------------------------------------------------+
*/
-/* $Id: reg.c,v 1.56 2001/12/23 15:56:41 mfischer Exp $ */
+/* $Id: reg.c,v 1.57 2002/01/05 01:59:11 jimw Exp $ */
#include <stdio.h>
#include "php.h"
@@ -369,7 +369,9 @@
if ('\\' == *walk
&& '0' <= walk[1] && '9' >= walk[1]
&& subs[walk[1] - '0'].rm_so > -1
- && subs[walk[1] - '0'].rm_eo > -1) {
+ && subs[walk[1] - '0'].rm_eo > -1
+ /* this next case shouldn't happen. it does. */
+ && subs[walk[1] - '0'].rm_so < subs[walk[1] - '0'].rm_eo) {
tmp = subs[walk[1] - '0'].rm_eo
- subs[walk[1] - '0'].rm_so;
memcpy (walkbuf,