aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/httpserver.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-04-16 20:14:51 +0200
committerStefan Boberg <[email protected]>2026-04-16 20:14:51 +0200
commit97631ddf50c5f3f22a7406fcbeaf4c12cf23b2ad (patch)
treedd67a8da584987686d6f1755bb8d67a23679bd3b /src/zenhttp/httpserver.cpp
parentFix VLA and potential stack overflow in GetCallstack on POSIX (diff)
downloadarchived-zen-97631ddf50c5f3f22a7406fcbeaf4c12cf23b2ad.tar.xz
archived-zen-97631ddf50c5f3f22a7406fcbeaf4c12cf23b2ad.zip
Guard against ArgV overflow in Linux IterateCommandlineArgs
The Linux branch walked /proc/self/cmdline into a fixed-size 255-entry array with no bounds check. A command line with more than 255 arguments (not unusual for build invocations, find-xargs pipelines, and CI drivers) wrote past the end of the local buffer and corrupted the stack. The fix needs to stay on the stack because IterateCommandlineArgs can run during static initialization, before our memory allocators are wired up, so heap-backed containers like std::vector are not safe here. Keep the fixed-size buffer, add a comment explaining the allocator constraint, and drop (with free()) any argv entries beyond kMaxArgs instead of writing them past the end of the array.
Diffstat (limited to 'src/zenhttp/httpserver.cpp')
0 files changed, 0 insertions, 0 deletions