Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-394

Faults in regex_replace function of regexfilter.c

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.2.1
    • 1.3.0
    • regexfilter
    • None
    • Any

    Description

      The function uses realloc without checks. More immediately significant, on line 456 the variable "result" is reallocated, but no change is made to the pointer to it. Consequently, the memcpy that follows is liable to write into the freed memory space resulting from the realloc operation.

      The function could be more effective if it made two passes, first computing the space required for the transformed string, then making a memory allocation (if necessary) and carrying out the replacements.

      But it would probably be better altogether to use the PCRE function "pcre2_substitute" which appears to do the job without any development effort at all.

      Attachments

        Activity

          People

            markus makela markus makela
            martin brampton martin brampton (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.