Skip to content

mod_rewrite: Don't expand %N from an uninitialized pointer (BZ 70369) - #1075

Open
arturobernalg wants to merge 1 commit into
apache:trunkfrom
arturobernalg:fix/httpd-70369-rewrite-expr-backref
Open

arturobernalg wants to merge 1 commit into
apache:trunkfrom
arturobernalg:fix/httpd-70369-rewrite-expr-backref

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

A "RewriteCond expr" that matches without a capturing regex leaves %N pointing at uninitialized memory: a following %N can crash the child or put stray bytes in the substitution. %N now expands to an empty string there.

Test: test/modules/mappers, RED on trunk (child SIGSEGV), GREEN with the fix.

https://bz.apache.org/bugzilla/show_bug.cgi?id=70369


  • This PR does not report or address a security vulnerability
    (see SECURITY.md and
    https://www.apache.org/security/#reporting-a-vulnerability).
  • Code follows the httpd style guide.
  • New log messages (level debug or higher) use an empty APLOGNO() tag;
    numbers are assigned by a committer at merge time (see docs/log-message-tags/README).
  • If the change is user-visible, a changes-entries/*.txt file is included,
    following the template in README.CHANGES (not needed otherwise).
  • Test cases based on pyhttpd are included where appropriate, in the
    test/modules/xxx directory matching the modules/xxx module source,
    or test/modules/core for core server changes. On Unix, verify these
    pass locally with e.g. make check-pytest PYTEST_DIRS=test/modules/xxx.

A "RewriteCond expr" that matches without running a capturing regex
left the source pointer unset and still copied it into the %N
backreference info, so a following %N read uninitialized memory.
Start it as NULL, which do_expand() treats as an empty backreference.

PR 70369. Reported by Wonseok Oh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant