From 007f8c41475ddbad34f29593bf0b744ebbca4a2a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 22 Mar 2017 15:50:03 +0100 Subject: [COVERITY] gui/main: fix implausible null pointer dereference Guard against NULL in the improbable case there's no PATH variable in the process' environment. --- gui/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gui/main.cpp b/gui/main.cpp index 4b3e1f14..0ba62ee8 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -72,9 +72,12 @@ void add_win32_path() for (const char* ptr : contents) { + if (ptr == nullptr) + continue; + strcat_s(env_path, sizeof(env_path), ptr); - if (ptr == nullptr || ptr[0] == '\0' || env_path[0] == '\0') + if (ptr[0] == '\0' || env_path[0] == '\0') { qDebug() << "bad path element, debug info:" << (ptr == nullptr ? "" : ptr) -- cgit v1.2.3