Skip to content

Commit 4f0c290

Browse files
author
Greg Roth
authored
Explicitly use n* version of vsnprintf (#4957) (#4978)
Newest clang makes use of older version a warning, which we get as an error (cherry picked from commit 79efe53)
1 parent 51c3200 commit 4f0c290

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

include/dxc/Support/Global.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ inline void OutputDebugFormatA(_In_ _Printf_format_string_ _Null_terminated_ con
167167

168168
va_list argList;
169169
va_start(argList, pszFormat);
170-
int count = vsprintf_s(buffer, _countof(buffer), pszFormat, argList);
170+
int count = vsnprintf_s(buffer, _countof(buffer), pszFormat, argList);
171171
va_end(argList);
172172

173173
OutputDebugStringA(buffer);

include/dxc/Support/WinAdapter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
#define _strdup strdup
184184
#define _strnicmp strnicmp
185185

186-
#define vsprintf_s vsprintf
186+
#define vsnprintf_s vsnprintf
187187
#define strcat_s strcat
188188
#define strcpy_s(dst, n, src) strncpy(dst, src, n)
189189
#define _vscwprintf vwprintf

tools/clang/lib/Parse/HLSLRootSignature.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ HRESULT RootSignatureParser::Error(uint32_t uErrorNum, LPCSTR pError, ...)
530530
va_list Args;
531531
char msg[512];
532532
va_start(Args, pError);
533-
vsprintf_s(msg, pError, Args);
533+
vsnprintf_s(msg, _countof(msg), pError, Args);
534534
va_end(Args);
535535
try {
536536
m_OS << msg;

0 commit comments

Comments
 (0)