Changeset 591


Ignore:
Timestamp:
Oct 31, 2025, 2:49:53 PM (8 hours ago)
Author:
katerina
Message:

Fix for ticket #479 (check for start of a pcre2 match later than its end).

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_log_evalrule.c

    r588 r591  
    10511051                                                sh_string_len(message));
    10521052
    1053   if (ovecnum > 1)
     1053  if (ovecnum > 1 && (ovector[0] < ovector[1])) /* guard against patterns using \K */
    10541054    {
    10551055      retval = sh_string_replace(retval, &(ovector[2]), (ovecnum-1), "___", 3);
  • trunk/src/sh_log_parse_apache.c

    r588 r591  
    341341
    342342      info->line_ovector = pcre2_get_ovector_pointer(match_data);
     343
     344      if (info->line_ovector[0] > info->line_ovector[1]) /* guard against patterns using \K */
     345        {
     346          char msg[128];
     347          sl_snprintf(msg, sizeof(msg), _("Matching error: start > end"));
     348         
     349          SH_MUTEX_LOCK(mutex_thread_nolog);
     350          sh_error_handle(SH_ERR_ERR, FIL__, __LINE__, 0, MSG_E_SUBGEN,
     351                          msg,
     352                          _("sh_parse_apache"));
     353          SH_MUTEX_UNLOCK(mutex_thread_nolog);
     354          goto the_end;
     355        }
    343356     
    344357      if (info->pos_time > 0)
     
    450463    sh_string_destroy(&msg);
    451464  }
     465 
     466 the_end:
    452467  pcre2_match_data_free(match_data);
    453468  return NULL;
Note: See TracChangeset for help on using the changeset viewer.