]> granicus.if.org Git - php/commitdiff
Fixed segfault in mb_ereg_match()
authorMoriyoshi Koizumi <moriyoshi@php.net>
Thu, 3 Apr 2003 00:15:13 +0000 (00:15 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Thu, 3 Apr 2003 00:15:13 +0000 (00:15 +0000)
ext/mbstring/php_mbregex.c

index 6227a916345b7b6679d25632cf0e26a86a2a67ed..27aef6cef1215f9cf9fc4deed24567823324fa70 100644 (file)
@@ -782,7 +782,8 @@ PHP_FUNCTION(mb_split)
    Regular expression match for multibyte string */
 PHP_FUNCTION(mb_ereg_match)
 {
-       zval *arg_pattern;
+       char *arg_pattern;
+       int arg_pattern_len;
 
        char *string;
        int string_len;
@@ -795,8 +796,8 @@ PHP_FUNCTION(mb_ereg_match)
                char *option_str = NULL;
                int option_str_len = 0;
 
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|s",
-                                         &arg_pattern, &string, &string_len,
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s",
+                                         &arg_pattern, &arg_pattern_len, &string, &string_len,
                                          &option_str, &option_str_len)==FAILURE) {
                        RETURN_FALSE;
                }
@@ -807,12 +808,11 @@ PHP_FUNCTION(mb_ereg_match)
                        option |= MBSTRG(regex_default_options);
                }
        }
-       convert_to_string_ex(&arg_pattern);
 
        err = php_mbregex_compile_pattern(
            &re,
-           Z_STRVAL_P(arg_pattern),
-           Z_STRLEN_P(arg_pattern),
+           arg_pattern,
+               arg_pattern_len,
            option, MBSTRG(current_mbctype) TSRMLS_CC);
 
        if (err) {