瀏覽代碼

libobs-d3d11: Replace invocations of sprintf with snprintf

Fixes deprecation warnings in Xcode 14/clang on macOS and reduces
chance of buffer overflows.
PatTheMav 3 年之前
父節點
當前提交
49ad848514
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      libobs-d3d11/d3d11-subsystem.cpp

+ 2 - 1
libobs-d3d11/d3d11-subsystem.cpp

@@ -330,7 +330,8 @@ void gs_device::InitCompiler()
 	int ver = 49;
 
 	while (ver > 30) {
-		sprintf(d3dcompiler, "D3DCompiler_%02d.dll", ver);
+		snprintf(d3dcompiler, sizeof(d3dcompiler),
+			 "D3DCompiler_%02d.dll", ver);
 
 		HMODULE module = LoadLibraryA(d3dcompiler);
 		if (module) {