Skip to content

mod_setenvif: Don't take SetEnvIfExpr backreferences from a stale match (BZ 70369) [2.4.x] - #1087

Merged
arturobernalg merged 1 commit into
apache:2.4.xfrom
arturobernalg:backport/httpd-70369-setenvif-expr-backref
Nov 26, 2026
Merged

arturobernalg merged 1 commit into
apache:2.4.xfrom
arturobernalg:backport/httpd-70369-setenvif-expr-backref

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

Backport of #1076 (1df6ffc on trunk) to 2.4.x. Clean cherry-pick.

test_005_setenvif.py fails on 2.4.x without the fix and passes with it.

BZ: 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.

…ch (BZ 70369) (apache#1076)

mod_setenvif: Don't take SetEnvIfExpr backreferences from a stale match.

For a SetEnvIfExpr rule, val and regm still held the previous rule's
value and match (or nothing at all), so $N in the value came from
another rule or from uninitialized memory whenever the expression ran
no capturing regex. Reset both before evaluating the expression, so
that $N comes only from its own capturing match and is empty otherwise.

PR 70369.

(cherry picked from commit 1df6ffc)
@covener

covener commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

@arturobernalg if you don't mind, can you put [2.4.x] at the front of the title rather than the end in future PRs? I think it's what /backport in the shared skill uses (and is easier to eyeball then remembering to set base:2.4.x in the filter.

@arturobernalg

Copy link
Copy Markdown
Member Author

@arturobernalg if you don't mind, can you put [2.4.x] at the front of the title rather than the end in future PRs? I think it's what /backport in the shared skill uses (and is easier to eyeball then remembering to set base:2.4.x in the filter.

@covener Go it.

@arturobernalg
arturobernalg merged commit 2202917 into apache:2.4.x Nov 26, 2026
36 checks passed
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.

2 participants