From 8128d1249b95794564f7d437bcf59fb0238c06c7 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Thu, 1 Dec 2016 11:38:22 +0000 Subject: [PATCH] fix uninit --- Common/Context.cpp | 1 + Common/OS.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Common/Context.cpp b/Common/Context.cpp index ccc00fb65e..6cb72bb96a 100644 --- a/Common/Context.cpp +++ b/Common/Context.cpp @@ -79,6 +79,7 @@ CTX::CTX() : gamepad(0) // need to initialize these too, since the corresponding opt_XXX routines use // the current value to detect changes + geom.hideCompounds = 1; mesh.changed = 0; mesh.qualityInf = mesh.qualitySup = mesh.qualityType = 0; mesh.radiusInf = mesh.radiusSup = 0; diff --git a/Common/OS.cpp b/Common/OS.cpp index 38ccd2e868..566536acfd 100644 --- a/Common/OS.cpp +++ b/Common/OS.cpp @@ -418,7 +418,9 @@ std::string GetExecutableFileName() } #elif defined(__linux__) char path[4096]; - if(readlink("/proc/self/exe", path, 4096) > 0){ + int n = readlink("/proc/self/exe", path, sizeof(path)); + if(n > 0 && n < sizeof(path)){ + path[n] = '\0'; name = std::string(path); } #endif -- GitLab