Hi,

Attached is an apply-ready patch against current apt main
(5e6dcc8d0c8bdce61e9cc7f497abadb5349d509a) for Bug#1129942.

The existing SaveInConfig() variable-length stack buffer can write its
separator at cmdline[sizeof(cmdline)] when a quoted option reaches the
truncation boundary. The patch builds the log value with a size-capped
std::string instead, retains the existing limit, reserves room for an
inserted closing quote, and handles argc == 0. It adds regressions for the
exact reproducer and the zero-argument case.

Verification on Debian trixie:
- Untouched ASan build: the exact reproducer aborts with
dynamic-stack-buffer-overflow at cmndline.cc:428.
- Patched ASan build: the same input has no sanitizer finding.
- ASan unit suite: 149/149 passed.
- Normal CTest run: 100% passed, 0 failed.

Thanks to Ilia Kashintsev for the original report and reproducer; the
commit includes a Reported-by trailer.

Regards,
Darren Carreras

Attachment: 0001-cmndline-bound-command-line-logging.patch
Description: Binary data

Reply via email to