]> git.ipfire.org Git - thirdparty/apache/httpd.git/commit
Add sanity checks for slotmem size calculations:
authorJoe Orton <jorton@apache.org>
Fri, 17 Jul 2026 14:20:18 +0000 (14:20 +0000)
committerJoe Orton <jorton@apache.org>
Fri, 17 Jul 2026 14:20:18 +0000 (14:20 +0000)
commit4b091668042f63e4afe755d3db8eff8bf9aafd0b
treeb3f0c2e008ac862ff9e0083cd30b76f0751d93d0
parent4f01170bf5b310a07f5cd65ab200f121d8fd933b
Add sanity checks for slotmem size calculations:

* modules/slotmem/mod_slotmem_plain.c,
  modules/slotmem/mod_slotmem_shm.c
  (slotmem_size_mul, slotmem_size_add): New helper functions for
  checked arithmetic on apr_size_t values.
  (slotmem_create): Use checked arithmetic for allocation size
  calculations to prevent integer overflow.
  (slotmem_grab): Add overflow check on size * id multiplication
  before pointer arithmetic.
  (slotmem_get): Validate dest_len against slot size before access,
  move inuse pointer dereference after bounds checks.
  (slotmem_put): Validate src_len against slot size before access,
  move inuse pointer dereference after bounds checks.

* modules/slotmem/mod_slotmem_shm.c (slotmem_fgrab): Add overflow
  check on size * id multiplication before pointer arithmetic.
  (slotmem_attach): Validate shared memory segment size against
  expected size computed with checked arithmetic. Use basesize
  variable for inuse pointer calculation.

Submitted by: metsw24-max <metsw24 gmail.com>
GitHub: closes #626

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1936268 13f79535-47bb-0310-9956-ffa450edef68
modules/slotmem/mod_slotmem_plain.c
modules/slotmem/mod_slotmem_shm.c