mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-20 20:39:09 +00:00
Bugfix: Fix possible buffer overflow (#901)
Upstream commit: 21ae37d (partial)
This commit is contained in:
parent
4fc8c042a2
commit
88aa771536
15
src/util.cpp
15
src/util.cpp
@ -653,20 +653,25 @@ string MyGetSpecialFolderPath(int nFolder, bool fCreate)
|
||||
}
|
||||
|
||||
// Backup option
|
||||
pszPath[0] = '\0';
|
||||
std::string strPath;
|
||||
{
|
||||
const char *pszEnv;
|
||||
if (nFolder == CSIDL_STARTUP)
|
||||
{
|
||||
strcpy(pszPath, getenv("USERPROFILE"));
|
||||
strcat(pszPath, "\\Start Menu\\Programs\\Startup");
|
||||
pszEnv = getenv("USERPROFILE");
|
||||
if (pszEnv)
|
||||
strPath = pszEnv;
|
||||
strPath += "\\Start Menu\\Programs\\Startup";
|
||||
}
|
||||
else if (nFolder == CSIDL_APPDATA)
|
||||
{
|
||||
strcpy(pszPath, getenv("APPDATA"));
|
||||
pszEnv = getenv("APPDATA");
|
||||
if (pszEnv)
|
||||
strPath = pszEnv;
|
||||
}
|
||||
}
|
||||
|
||||
return pszPath;
|
||||
return strPath;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user