diff options
author | Moriyoshi Koizumi <moriyoshi@php.net> | 2003-09-26 17:47:10 +0000 |
---|---|---|
committer | Moriyoshi Koizumi <moriyoshi@php.net> | 2003-09-26 17:47:10 +0000 |
commit | 18557cba09ebf1cecee140348dae6d1b14d47c3a (patch) | |
tree | 5bc39298a925e21483195e9f17c38f60084eaf93 /ext/mbstring/php_mbregex.c | |
parent | 2fb568e65e7806992d47e40488bf7b3fb17ad48b (diff) | |
download | php-git-18557cba09ebf1cecee140348dae6d1b14d47c3a.tar.gz |
MFH(r-1.45): repatch fixes for the problem that was reported at php-dev@php.gr.jp (#884)
Diffstat (limited to 'ext/mbstring/php_mbregex.c')
-rw-r--r-- | ext/mbstring/php_mbregex.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 488a999b8f..0869f51c40 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -507,7 +507,7 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option) } if (err >= 0) { #if moriyoshi_0 - if ( regs.beg[0] == regs.end[0] ) { + if (regs.beg[0] == regs.end[0]) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression"); break; } @@ -552,16 +552,15 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option) if (pos < n) { pos = n; } else { - _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], 1 ); + if (pos < string_len) { + _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], 1); + } pos++; } } else { /* nomatch */ /* stick that last bit of string on our output */ - int l = string_len - pos; - if (l > 0) { - _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], l); - } else { - outdev.pos += l; + if (pos < string_len) { + _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], string_len - pos); } } } |