mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-28 12:23:28 +00:00
[CMD]: Check for cmd_realloc returned value. Adapted from patch by Patrick Martin, see CORE-7298.
svn path=/trunk/; revision=67065
This commit is contained in:
@@ -59,7 +59,13 @@ INT cmd_path (LPTSTR param)
|
||||
}
|
||||
else if (dwBuffer > ENV_BUFFER_SIZE)
|
||||
{
|
||||
LPTSTR pszOldBuffer = pszBuffer;
|
||||
pszBuffer = (LPTSTR)cmd_realloc (pszBuffer, dwBuffer * sizeof (TCHAR));
|
||||
if (pszBuffer == NULL)
|
||||
{
|
||||
cmd_free(pszOldBuffer);
|
||||
return 1;
|
||||
}
|
||||
GetEnvironmentVariable (_T("PATH"), pszBuffer, dwBuffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,13 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
|
||||
dwBuffer = GetEnvironmentVariable (_T("PATHEXT"), pszPathExt, ENV_BUFFER_SIZE);
|
||||
if (dwBuffer > ENV_BUFFER_SIZE)
|
||||
{
|
||||
LPTSTR pszOldPathExt = pszPathExt;
|
||||
pszPathExt = (LPTSTR)cmd_realloc (pszPathExt, dwBuffer * sizeof (TCHAR));
|
||||
if (pszPathExt == NULL)
|
||||
{
|
||||
cmd_free(pszOldPathExt);
|
||||
return FALSE;
|
||||
}
|
||||
GetEnvironmentVariable (_T("PATHEXT"), pszPathExt, dwBuffer);
|
||||
_tcslwr(pszPathExt);
|
||||
}
|
||||
@@ -184,7 +190,14 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
|
||||
dwBuffer = GetEnvironmentVariable (_T("PATH"), pszPath, ENV_BUFFER_SIZE);
|
||||
if (dwBuffer > ENV_BUFFER_SIZE)
|
||||
{
|
||||
LPTSTR pszOldPath = pszPath;
|
||||
pszPath = (LPTSTR)cmd_realloc (pszPath, dwBuffer * sizeof (TCHAR));
|
||||
if (pszPath == NULL)
|
||||
{
|
||||
cmd_free(pszOldPath);
|
||||
cmd_free(pszPathExt);
|
||||
return FALSE;
|
||||
}
|
||||
GetEnvironmentVariable (_T("PATH"), pszPath, dwBuffer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user