From: Iain Patterson Date: Sat, 28 Dec 2013 17:02:30 +0000 (+0000) Subject: Fixed arguments to mbstowcs_s(). X-Git-Tag: v2.22~106 X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=04368b24e449523614478537d12747e3ec778f00;hp=1c7716c9a9bf3e8dd844fd27d1351dab6ceaf510;p=nssm.git Fixed arguments to mbstowcs_s(). The third argument to mbstowcs_s() is a buffer size not a character count. --- diff --git a/imports.cpp b/imports.cpp index 9ffd486..d0970bd 100644 --- a/imports.cpp +++ b/imports.cpp @@ -32,9 +32,9 @@ FARPROC get_import(HMODULE library, const char *function, unsigned long *error) size_t buflen; mbstowcs_s(&buflen, NULL, 0, function, _TRUNCATE); function_name = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, buflen * sizeof(TCHAR)); - if (function_name) mbstowcs_s(&buflen, function_name, buflen, function, _TRUNCATE); + if (function_name) mbstowcs_s(&buflen, function_name, buflen * sizeof(TCHAR), function, _TRUNCATE); #else - function_name = function; + function_name = (TCHAR *) function; #endif log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_GETPROCADDRESS_FAILED, function_name, error_string(*error), 0); #ifdef UNICODE