Skip to content

mod_cgid: Raise environment variable limit to APACHE_ARG_MAX - #850

Closed
notroj wants to merge 4 commits into
apache:trunkfrom
notroj:cgid-env-max
Closed

notroj wants to merge 4 commits into
apache:trunkfrom
notroj:cgid-env-max

Conversation

@notroj

@notroj notroj commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Raise mod_cgid's limit on the number of environment variables passed to a script from the hardcoded 256 of ENV_COUNT_MAX to APACHE_ARG_MAX (4096 on most platforms), fixing Bugzilla PR 70270. The limit is now also enforced on the sender side: send_req() fails with APR_ENOSPC before writing anything to the daemon, so an oversized environment gets a clean 503 rather than a mid-protocol failure.

Tested in test/modules/generators: a 300-variable environment reaches the script intact (fails against trunk), and one over the limit is refused.

🤖 Generated with Claude Code

  APACHE_ARG_MAX rather than ENV_COUNT_MAX.
  (send_req): Fail with APR_ENOSPC for an environment larger than
  APACHE_ARG_MAX.

* test/modules/generators/test_001_cgid.py
  (test_generators_001_08_env_count_large,
  test_generators_001_09_env_count_overflow): New tests.

* test/modules/generators/htdocs/cgi/envcount.py: New script.

* changes-entries/cgid-env-limit.txt: New entry.

PR: 70270
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@arturobernalg

Copy link
Copy Markdown
Member

+1, looks good to me.

notroj and others added 3 commits October 16, 2026 17:40
  uri_len and args_len by limit_req_line rather than APR_PATH_MAX.

Submitted by: Emmanuel Dreyfus <manu netbsd.org>
Reviewed by: jorton
PR: 70270
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
  values by new ENV_VAL_MAX rather than APR_PATH_MAX.

* test/modules/generators/test_001_cgid.py
  (test_generators_001_15_long_query): New test.

* test/modules/generators/htdocs/cgi/arglen.py: New script.

PR: 70270
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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