aboutsummaryrefslogtreecommitdiff
path: root/src/qt/guiutil.cpp
diff options
context:
space:
mode:
authorpracticalswift <[email protected]>2017-08-29 20:06:30 +0200
committerpracticalswift <[email protected]>2017-09-06 09:06:47 +0200
commit3a4401a6b899694d25b5ac89c8068e45711bab36 (patch)
tree9c0208310151113af1f043cd384e836c9ab43327 /src/qt/guiutil.cpp
parentMerge #11150: [tests] Add getmininginfo test (diff)
downloaddiscoin-3a4401a6b899694d25b5ac89c8068e45711bab36.tar.xz
discoin-3a4401a6b899694d25b5ac89c8068e45711bab36.zip
[Qt] Terminate string *pszExePath after readlink and without using memset
Diffstat (limited to 'src/qt/guiutil.cpp')
-rw-r--r--src/qt/guiutil.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index f3c5daebe..6d3ee5cb2 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -743,9 +743,10 @@ bool SetStartOnSystemStartup(bool fAutoStart)
else
{
char pszExePath[MAX_PATH+1];
- memset(pszExePath, 0, sizeof(pszExePath));
- if (readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1) == -1)
+ ssize_t r = readlink("/proc/self/exe", pszExePath, sizeof(pszExePath) - 1);
+ if (r == -1)
return false;
+ pszExePath[r] = '\0';
fs::create_directories(GetAutostartDir());