summaryrefslogtreecommitdiff
path: root/include/m_netlib.h
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-08-15 15:36:31 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-08-15 15:36:31 +0000
commit142bb501e4b61b23cbc597efdc92b5ba2e9e39a6 (patch)
tree46597e8004183bdf4cd986e7d76edcf5280d7463 /include/m_netlib.h
parent72d5ba62c6faa34b27fef32479d6ad4079ef75df (diff)
fix for a stack overrun in Netlib_LogW()
git-svn-id: http://svn.miranda-ng.org/main/trunk@10195 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include/m_netlib.h')
-rw-r--r--include/m_netlib.h44
1 files changed, 14 insertions, 30 deletions
diff --git a/include/m_netlib.h b/include/m_netlib.h
index 4f7ed1af38..3e76a5540d 100644
--- a/include/m_netlib.h
+++ b/include/m_netlib.h
@@ -701,40 +701,24 @@ typedef struct
static INT_PTR Netlib_Logf(HANDLE hUser, const char *fmt, ...)
{
va_list va;
+ va_start(va, fmt);
char szText[1024];
-
- __try
- {
- va_start(va, fmt);
- mir_vsnprintf(szText, sizeof(szText), fmt, va);
- va_end(va);
- return CallService(MS_NETLIB_LOG, (WPARAM)hUser, (LPARAM)szText);
- }
- __except(EXCEPTION_EXECUTE_HANDLER) {}
- return 0;
+ mir_vsnprintf(szText, sizeof(szText), fmt, va);
+ va_end(va);
+ return CallService(MS_NETLIB_LOG, (WPARAM)hUser, (LPARAM)szText);
}
-#ifdef _UNICODE
- static INT_PTR Netlib_LogfW(HANDLE hUser, const wchar_t *fmt, ...)
- {
- va_list va;
- wchar_t szText[1024];
-
- __try
- {
- va_start(va, fmt);
- mir_vsntprintf(szText, sizeof(szText), fmt, va);
- va_end(va);
- return CallService(MS_NETLIB_LOGW, (WPARAM)hUser, (LPARAM)szText);
- }
- __except(EXCEPTION_EXECUTE_HANDLER) {}
- return 0;
- }
- #define Netlib_LogfT Netlib_LogfW
-#else
- #define Netlib_LogfT Netlib_Logf
-#endif
+static INT_PTR Netlib_LogfW(HANDLE hUser, const wchar_t *fmt, ...)
+{
+ va_list va;
+ va_start(va, fmt);
+ wchar_t szText[1024];
+ mir_vsnwprintf(szText, SIZEOF(szText), fmt, va);
+ va_end(va);
+ return CallService(MS_NETLIB_LOGW, (WPARAM)hUser, (LPARAM)szText);
+}
+#define Netlib_LogfT Netlib_LogfW
#endif //defined va_start
/////////////////////////////////////////////////////////////////////////////////////////