mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-20 03:50:08 +00:00
Merge #11193: [Qt] Terminate string *pszExePath after readlink and without using memset
3a4401a [Qt] Terminate string *pszExePath after readlink and without using memset (practicalswift) Pull request description: Terminate string `*pszExePath` after `readlink` and before passing to operator `<<`. * `ssize_t readlink(const char *pathname, char *buf, size_t bufsiz)` does not append a null byte to `buf`. * Operator `<<` expects a null-terminated string. Tree-SHA512: fc18844bb23059fead8db0cb9b4b4ba6188f58e3f19ab4719c2737cc5dd6df23ae7d4804ef2820d39b334204a48ee3de1d202c272bcd156e60761af2fcb9349d
This commit is contained in:
commit
c5c77bdcc6
@ -744,9 +744,10 @@ bool SetStartOnSystemStartup(bool fAutoStart)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
char pszExePath[MAX_PATH+1];
|
char pszExePath[MAX_PATH+1];
|
||||||
memset(pszExePath, 0, sizeof(pszExePath));
|
ssize_t r = readlink("/proc/self/exe", pszExePath, sizeof(pszExePath) - 1);
|
||||||
if (readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1) == -1)
|
if (r == -1)
|
||||||
return false;
|
return false;
|
||||||
|
pszExePath[r] = '\0';
|
||||||
|
|
||||||
fs::create_directories(GetAutostartDir());
|
fs::create_directories(GetAutostartDir());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user