]> granicus.if.org Git - php/commitdiff
Reduce error buffer size
authorAnatol Belski <ab@php.net>
Thu, 5 Jul 2018 15:23:47 +0000 (17:23 +0200)
committerAnatol Belski <ab@php.net>
Thu, 5 Jul 2018 15:24:38 +0000 (17:24 +0200)
120 bytes is ample, the doc says.

ext/mbstring/mbstring.c
ext/opcache/zend_accelerator_blacklist.c
ext/pcre/php_pcre.c
ext/pgsql/pgsql.c

index 8a6de170dc48ab163f037c8b61bdc8ff93922096..01c070b5846edeeccab6f27b2e68a7e78ea2f2dd 100644 (file)
@@ -1051,7 +1051,7 @@ static void *_php_mb_compile_regex(const char *pattern)
 
        if (!(retval = pcre2_compile((PCRE2_SPTR)pattern, PCRE2_ZERO_TERMINATED,
                        PCRE2_CASELESS, &errnum, &err_offset, php_pcre_cctx()))) {
-               PCRE2_UCHAR err_str[256];
+               PCRE2_UCHAR err_str[128];
                pcre2_get_error_message(errnum, err_str, sizeof(err_str));
                php_error_docref(NULL, E_WARNING, "%s (offset=%zu): %s", pattern, err_offset, err_str);
        }
index ed18994f853298136bbb681ade9d8c85bcfe97e1..e2b510c6cd321b1a2133abc73413f11cbed5738c 100644 (file)
@@ -73,7 +73,7 @@ static void blacklist_report_regexp_error(const char *pcre_error, int pcre_error
 
 static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
 {
-       PCRE2_UCHAR pcre_error[256];
+       PCRE2_UCHAR pcre_error[128];
        int i, errnumber;
        PCRE2_SIZE pcre_error_offset;
        zend_regexp_list **regexp_list_it, *it;
index c365c9f475e923f1e7167d1adaf39dc8e9814881..7555428f422f3c09c835547910bd443a4ada8d5f 100644 (file)
@@ -534,7 +534,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
        pcre2_code                      *re = NULL;
        uint32_t                         coptions = 0;
        uint32_t                         extra_coptions = PHP_PCRE_DEFAULT_EXTRA_COPTIONS;
-       PCRE2_UCHAR              error[256];
+       PCRE2_UCHAR              error[128];
        PCRE2_SIZE           erroffset;
        int                  errnumber;
        char                             delimiter;
index 1235781d987e50311848abc73dc17cd631b53b6c..d22b6dfc593251dfe27cbaa4dcced96722864e82 100644 (file)
@@ -5759,7 +5759,7 @@ static int php_pgsql_convert_match(const char *str, size_t str_len, const char *
 
        re = pcre2_compile((PCRE2_SPTR)regex, regex_len, options, &errnumber, &err_offset, php_pcre_cctx());
        if (NULL == re) {
-               PCRE2_UCHAR err_msg[256];
+               PCRE2_UCHAR err_msg[128];
                pcre2_get_error_message(errnumber, err_msg, sizeof(err_msg));
                php_error_docref(NULL, E_WARNING, "Cannot compile regex: '%s'", err_msg);
                return FAILURE;