diff -ur php5-200309180130.orig/ext/mbstring/php_mbregex.c php5-200309180130/ext/mbstring/php_mbregex.c --- php5-200309180130.orig/ext/mbstring/php_mbregex.c Sat Aug 23 16:07:41 2003 +++ php5-200309180130/ext/mbstring/php_mbregex.c Mon Sep 22 00:36:52 2003 @@ -653,7 +653,12 @@ } } else { /* nomatch */ /* stick that last bit of string on our output */ - smart_str_appendl(&out_buf, pos, (size_t)((UChar *)(string + string_len) - pos)); + int l = (UChar *)(string + string_len) - pos; + if (l > 0) { + smart_str_appendl(&out_buf, pos, l); + } else { + out_buf.len += l; + } } php_mb_regex_region_free(regs, 0); }