mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
Merge bitcoin/bitcoin#26434: [24.x] [gui] Bugfix: Check for readlink buffer overflow and handle gracefully
e049fd76f0
Bugfix: Check for readlink buffer overflow and handle gracefully (Luke Dashjr) Pull request description: Identical commit taken as-is from https://github.com/bitcoin/bitcoin/pull/25548 for backport ACKs for top commit: hebasto: ACKe049fd76f0
Tree-SHA512: 37e63d570de898187c1bc8dd311c299c527adea51faa08aa6a3923bdb9390e3263902ace3d52a1cfc34ac2ba84e9358961574f886be1f64b5749a62e3c50ad57
This commit is contained in:
commit
067dc42b79
1 changed files with 3 additions and 2 deletions
|
@ -615,9 +615,10 @@ bool SetStartOnSystemStartup(bool fAutoStart)
|
|||
else
|
||||
{
|
||||
char pszExePath[MAX_PATH+1];
|
||||
ssize_t r = readlink("/proc/self/exe", pszExePath, sizeof(pszExePath) - 1);
|
||||
if (r == -1)
|
||||
ssize_t r = readlink("/proc/self/exe", pszExePath, sizeof(pszExePath));
|
||||
if (r == -1 || r > MAX_PATH) {
|
||||
return false;
|
||||
}
|
||||
pszExePath[r] = '\0';
|
||||
|
||||
fs::create_directories(GetAutostartDir());
|
||||
|
|
Loading…
Add table
Reference in a new issue