Commit a65ec89a authored by Jonathan Marten's avatar Jonathan Marten
Browse files

kfmclient: qEnvironmentVariableIntValue() is safer than atoi(getenv())

Avoids a null pointer crash if KDE_FULL_SESSION is set
but KDE_SESSION_VERSION is not.
parent 80768b67
Pipeline #166860 passed with stage
in 8 minutes and 25 seconds
......@@ -99,7 +99,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
// Use kfmclient from the session KDE version
if ((args.at(0) == QLatin1String("openURL") || args.at(0) == QLatin1String("newTab"))
&& qEnvironmentVariableIsSet("KDE_FULL_SESSION")) {
const int version = atoi(getenv("KDE_SESSION_VERSION"));
const int version = qEnvironmentVariableIntValue("KDE_SESSION_VERSION");
if (version != 0 && version != KCOREADDONS_VERSION_MAJOR) {
qCDebug(KFMCLIENT_LOG) << "Forwarding to kfmclient from KDE version " << version;
char wrapper[ 10 ];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment