Reduce error buffer size

120 bytes is ample, the doc says.
This commit is contained in:
Anatol Belski 2018-07-05 17:23:47 +02:00
parent 169d454593
commit 0630e3bc03
4 changed files with 4 additions and 4 deletions

View file

@ -1051,7 +1051,7 @@ static void *_php_mb_compile_regex(const char *pattern)
if (!(retval = pcre2_compile((PCRE2_SPTR)pattern, PCRE2_ZERO_TERMINATED, if (!(retval = pcre2_compile((PCRE2_SPTR)pattern, PCRE2_ZERO_TERMINATED,
PCRE2_CASELESS, &errnum, &err_offset, php_pcre_cctx()))) { 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)); 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); php_error_docref(NULL, E_WARNING, "%s (offset=%zu): %s", pattern, err_offset, err_str);
} }

View 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) static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
{ {
PCRE2_UCHAR pcre_error[256]; PCRE2_UCHAR pcre_error[128];
int i, errnumber; int i, errnumber;
PCRE2_SIZE pcre_error_offset; PCRE2_SIZE pcre_error_offset;
zend_regexp_list **regexp_list_it, *it; zend_regexp_list **regexp_list_it, *it;

View file

@ -534,7 +534,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
pcre2_code *re = NULL; pcre2_code *re = NULL;
uint32_t coptions = 0; uint32_t coptions = 0;
uint32_t extra_coptions = PHP_PCRE_DEFAULT_EXTRA_COPTIONS; uint32_t extra_coptions = PHP_PCRE_DEFAULT_EXTRA_COPTIONS;
PCRE2_UCHAR error[256]; PCRE2_UCHAR error[128];
PCRE2_SIZE erroffset; PCRE2_SIZE erroffset;
int errnumber; int errnumber;
char delimiter; char delimiter;

View 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()); re = pcre2_compile((PCRE2_SPTR)regex, regex_len, options, &errnumber, &err_offset, php_pcre_cctx());
if (NULL == re) { if (NULL == re) {
PCRE2_UCHAR err_msg[256]; PCRE2_UCHAR err_msg[128];
pcre2_get_error_message(errnumber, err_msg, sizeof(err_msg)); pcre2_get_error_message(errnumber, err_msg, sizeof(err_msg));
php_error_docref(NULL, E_WARNING, "Cannot compile regex: '%s'", err_msg); php_error_docref(NULL, E_WARNING, "Cannot compile regex: '%s'", err_msg);
return FAILURE; return FAILURE;