crash: fix off-end read when copying environ array

This commit is contained in:
outfoxxed 2024-09-02 22:19:36 -07:00
parent 397476244c
commit 465d5402f2
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E

View file

@ -126,8 +126,10 @@ bool CrashHandlerPrivate::minidumpCallback(
auto populateEnv = [&]() {
auto senvi = 0;
while (envi < 4095) {
env[envi++] = environ[senvi++]; // NOLINT
while (envi != 4095) {
auto var = environ[senvi++]; // NOLINT
if (var == nullptr) break;
env[envi++] = var;
}
env[envi] = nullptr;