mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-30 17:58:37 +08:00
win-capture: Replace invocations of sprintf with snprintf
Fixes deprecation warnings in Xcode 14/clang on macOS and reduces chance of buffer overflows.
This commit is contained in:
@@ -823,7 +823,7 @@ static void pipe_log(void *param, uint8_t *data, size_t size)
|
||||
static inline bool init_pipe(struct game_capture *gc)
|
||||
{
|
||||
char name[64];
|
||||
sprintf(name, "%s%lu", PIPE_NAME, gc->process_id);
|
||||
snprintf(name, sizeof(name), "%s%lu", PIPE_NAME, gc->process_id);
|
||||
|
||||
if (!ipc_pipe_server_start(&gc->pipe, name, pipe_log, gc)) {
|
||||
warn("init_pipe: failed to start pipe");
|
||||
|
||||
@@ -65,7 +65,8 @@ static inline void wait_for_dll_main_finish(HANDLE thread_handle)
|
||||
bool init_pipe(void)
|
||||
{
|
||||
char new_name[64];
|
||||
sprintf(new_name, "%s%lu", PIPE_NAME, GetCurrentProcessId());
|
||||
snprintf(new_name, sizeof(new_name), "%s%lu", PIPE_NAME,
|
||||
GetCurrentProcessId());
|
||||
|
||||
const bool success = ipc_pipe_client_open(&pipe, new_name);
|
||||
if (!success) {
|
||||
|
||||
Reference in New Issue
Block a user