[Ttssh2-commit] [7643] OutputDebugPrintf()#ttlib.c内_vsnprintf_s()を使って文字列をフォーマットするよう変更

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 5月 6日 (月) 22:41:08 JST


Revision: 7643
          https://osdn.net/projects/ttssh2/scm/svn/commits/7643
Author:   zmatsuo
Date:     2019-05-06 22:41:08 +0900 (Mon, 06 May 2019)
Log Message:
-----------
OutputDebugPrintf()#ttlib.c内_vsnprintf_s()を使って文字列をフォーマットするよう変更

Modified Paths:
--------------
    trunk/doc/ja/html/reference/sourcecode.html
    trunk/teraterm/common/ttlib.c

-------------- next part --------------
Modified: trunk/doc/ja/html/reference/sourcecode.html
===================================================================
--- trunk/doc/ja/html/reference/sourcecode.html	2019-05-06 13:40:58 UTC (rev 7642)
+++ trunk/doc/ja/html/reference/sourcecode.html	2019-05-06 13:41:08 UTC (rev 7643)
@@ -435,7 +435,7 @@
 	char tmp[1024];
 	va_list arg;
 	va_start(arg, fmt);
-	_vsnprintf(tmp, sizeof(tmp), fmt, arg);
+	_vsnprintf_s(tmp, sizeof(tmp), _TRUNCATE, fmt, arg);
 	OutputDebugString(tmp);
 }
 </pre>

Modified: trunk/teraterm/common/ttlib.c
===================================================================
--- trunk/teraterm/common/ttlib.c	2019-05-06 13:40:58 UTC (rev 7642)
+++ trunk/teraterm/common/ttlib.c	2019-05-06 13:41:08 UTC (rev 7643)
@@ -1054,20 +1054,22 @@
 	char tmp[1024];
 	va_list arg;
 	va_start(arg, fmt);
-	_vsnprintf(tmp, sizeof(tmp), fmt, arg);
+	_vsnprintf_s(tmp, sizeof(tmp), _TRUNCATE, fmt, arg);
 	va_end(arg);
 	OutputDebugStringA(tmp);
 }
 
+#if defined(UNICODE)
 void OutputDebugPrintfW(const wchar_t *fmt, ...)
 {
 	wchar_t tmp[1024];
 	va_list arg;
 	va_start(arg, fmt);
-	_vsnwprintf(tmp, _countof(tmp), fmt, arg);
+	_vsnwprintf_s(tmp, _countof(tmp), _TRUNCATE, fmt, arg);
 	va_end(arg);
 	OutputDebugStringW(tmp);
 }
+#endif
 
 #if (_MSC_VER < 1800)
 BOOL vercmp(


Ttssh2-commit メーリングリストの案内
Back to archive index