diff options
author | George Hazan <george.hazan@gmail.com> | 2013-10-11 15:00:13 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-10-11 15:00:13 +0000 |
commit | 2ddab099442449a7f5f14014f5bf283cfb59501d (patch) | |
tree | 64cc98423a7078a21cf548e3c737125ffabd6e62 /src/mir_core | |
parent | 0cd1b4c03c8eca2b1518997f87631248b680beb9 (diff) |
stupid _s function causes buffer overflow instead of cutting string out
git-svn-id: http://svn.miranda-ng.org/main/trunk@6438 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_core')
-rw-r--r-- | src/mir_core/protos.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mir_core/protos.cpp b/src/mir_core/protos.cpp index 02d5cb2139..95648a4333 100644 --- a/src/mir_core/protos.cpp +++ b/src/mir_core/protos.cpp @@ -48,14 +48,16 @@ void UninitProtocols() MIR_CORE_DLL(void) ProtoLogA(struct PROTO_INTERFACE *pThis, LPCSTR szFormat, va_list args)
{
char buf[4096];
- vsprintf_s(buf, sizeof(buf), szFormat, args);
+ _vsnprintf(buf, sizeof(buf), szFormat, args);
+ buf[sizeof(buf)-1] = 0;
CallService(MS_NETLIB_LOG, (WPARAM)pThis->m_hNetlibUser, (LPARAM)buf);
}
MIR_CORE_DLL(void) ProtoLogW(struct PROTO_INTERFACE *pThis, LPCWSTR wszFormat, va_list args)
{
WCHAR buf[4096];
- vswprintf_s(buf, SIZEOF(buf), wszFormat, args);
+ _vsnwprintf(buf, SIZEOF(buf), wszFormat, args);
+ buf[SIZEOF(buf)-1] = 0;
CallService(MS_NETLIB_LOGW, (WPARAM)pThis->m_hNetlibUser, (LPARAM)buf);
}
|