Skip to content

Commit

Permalink
Be more aggressive in making sure that substring matches are valid in
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jimwins committed Jan 5, 2002
1 parent 6823fb1 commit 9a171d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ext/ereg/ereg.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
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,
Expand Down
4 changes: 3 additions & 1 deletion ext/standard/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
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,
Expand Down

0 comments on commit 9a171d0

Please sign in to comment.