mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[CRT]
- Fix stat64_to_stat macro definition. Patch by Víctor Martínez. - Fix out-of-memory error cases in environment functions. - Spotted by PVS-Studio CORE-7039 #resolve svn path=/trunk/; revision=58642
This commit is contained in:
parent
a08dba228c
commit
8e08d249db
2 changed files with 8 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* environ.c
|
||||
*
|
||||
* ReactOS MSVCRT.DLL Compatibility Library
|
||||
|
@ -64,11 +64,11 @@ int BlockEnvToEnvironA(void)
|
|||
{
|
||||
if ((*envptr = malloc(len)) == NULL)
|
||||
{
|
||||
for (envptr--; envptr >= _environ; envptr--);
|
||||
for (envptr--; envptr >= _environ; envptr--)
|
||||
free(*envptr);
|
||||
FreeEnvironmentStringsA(environment_strings);
|
||||
free(_environ);
|
||||
__initenv = _environ = NULL;
|
||||
__initenv = _environ = NULL;
|
||||
return -1;
|
||||
}
|
||||
memcpy(*envptr++, ptr, len);
|
||||
|
@ -116,11 +116,11 @@ int BlockEnvToEnvironW(void)
|
|||
{
|
||||
if ((*envptr = malloc(len * sizeof(wchar_t))) == NULL)
|
||||
{
|
||||
for (envptr--; envptr >= _wenviron; envptr--);
|
||||
for (envptr--; envptr >= _wenviron; envptr--)
|
||||
free(*envptr);
|
||||
FreeEnvironmentStringsW(environment_strings);
|
||||
free(_wenviron);
|
||||
__winitenv = _wenviron = NULL;
|
||||
__winitenv = _wenviron = NULL;
|
||||
return -1;
|
||||
}
|
||||
memcpy(*envptr++, ptr, len * sizeof(wchar_t));
|
||||
|
@ -168,7 +168,7 @@ char **DuplicateEnvironment(char **original_environment, int wide)
|
|||
*newenvptr = _strdup(*envptr++);
|
||||
if (*newenvptr == NULL)
|
||||
{
|
||||
for (newenvptr--; newenvptr >= newenv; newenvptr--);
|
||||
for (newenvptr--; newenvptr >= newenv; newenvptr--)
|
||||
free(*newenvptr);
|
||||
free(newenv);
|
||||
return original_environment;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <tchar.h>
|
||||
|
||||
#define stat64_to_stat(buf64, buf) \
|
||||
do { \
|
||||
buf->st_dev = (buf64)->st_dev; \
|
||||
buf->st_ino = (buf64)->st_ino; \
|
||||
buf->st_mode = (buf64)->st_mode; \
|
||||
|
@ -13,6 +14,7 @@
|
|||
buf->st_atime = (time_t)(buf64)->st_atime; \
|
||||
buf->st_mtime = (time_t)(buf64)->st_mtime; \
|
||||
buf->st_ctime = (time_t)(buf64)->st_ctime; \
|
||||
} while (0)
|
||||
|
||||
int CDECL _tstat(const _TCHAR* path, struct _stat * buf)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue