projects
/
reactos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[REACTOS] Fix 64 bit issues
[reactos.git]
/
base
/
services
/
tcpsvcs
/
log.c
diff --git
a/base/services/tcpsvcs/log.c
b/base/services/tcpsvcs/log.c
index
6b11724
..
3b2d467
100644
(file)
--- a/
base/services/tcpsvcs/log.c
+++ b/
base/services/tcpsvcs/log.c
@@
-1,7
+1,7
@@
/*
* PROJECT: ReactOS simple TCP/IP services
* LICENSE: GPL - See COPYING in the top level directory
/*
* PROJECT: ReactOS simple TCP/IP services
* LICENSE: GPL - See COPYING in the top level directory
- * FILE:
/
base/services/tcpsvcs/log.c
+ * FILE: base/services/tcpsvcs/log.c
* PURPOSE: Logging functionality for the service
* COPYRIGHT: Copyright 2008 Ged Murphy <gedmurphy@reactos.org>
*
* PURPOSE: Logging functionality for the service
* COPYRIGHT: Copyright 2008 Ged Murphy <gedmurphy@reactos.org>
*
@@
-70,20
+70,20
@@
LogToFile(LPCWSTR lpMsg,
UINT flags)
{
LPWSTR lpFullMsg = NULL;
UINT flags)
{
LPWSTR lpFullMsg = NULL;
-
DWORD
msgLen;
+
SIZE_T
msgLen;
msgLen = wcslen(lpMsg) + 1;
if (flags & LOG_ERROR)
{
msgLen = wcslen(lpMsg) + 1;
if (flags & LOG_ERROR)
{
- LP
VOID
lpSysMsg;
+ LP
WSTR
lpSysMsg;
DWORD eMsgLen;
eMsgLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
errNum,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
DWORD eMsgLen;
eMsgLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
errNum,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LP
T
STR)&lpSysMsg,
+ (LP
W
STR)&lpSysMsg,
0,
NULL);
0,
NULL);
@@
-122,6
+122,13
@@
LogToFile(LPCWSTR lpMsg,
}
}
}
}
+ /* Make sure the length in bytes doesn't overflow a DWORD */
+ msgLen = wcslen(lpFullMsg);
+ if (msgLen > (MAXDWORD / sizeof(WCHAR)))
+ {
+ RaiseException(EXCEPTION_INT_OVERFLOW, 0, 0, NULL);
+ }
+
if (lpFullMsg)
{
DWORD bytesWritten;
if (lpFullMsg)
{
DWORD bytesWritten;
@@
-130,7
+137,7
@@
LogToFile(LPCWSTR lpMsg,
bRet = WriteFile(hLogFile,
lpFullMsg,
bRet = WriteFile(hLogFile,
lpFullMsg,
-
wcslen(lpFullMsg)
* sizeof(WCHAR),
+
(DWORD)msgLen
* sizeof(WCHAR),
&bytesWritten,
&olWrite);
if (!bRet)
&bytesWritten,
&olWrite);
if (!bRet)