]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: cfgparse: limit file size loaded via /dev/stdin
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Tue, 20 Aug 2024 08:04:03 +0000 (10:04 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Aug 2024 12:28:34 +0000 (14:28 +0200)
commit8b1dfa9def6808bbebc3579279ddc70b0251c119
treed79fff62b61cd03cb0e5155c63f468156bfbd2b8
parentfd48b28315a923a6941ced201a2b6c58f426c427
MINOR: cfgparse: limit file size loaded via /dev/stdin

load_cfg_in_mem() can continuously reallocate memory in order to load an
extremely large input from /dev/stdin, until it fails with ENOMEM, which means
that process has consumed all available RAM. In case of containers and
virtualized environments it's not very good.

So, in order to prevent this, let's introduce MAX_CFG_SIZE as 10MB, which will
limit the size of input supplied via /dev/stdin.
include/haproxy/defaults.h
src/cfgparse.c