From 3ec3dfa2213300c6d7e884c6eb494f480b8ec023 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 11 Jun 2023 14:07:43 +0200 Subject: [PATCH] Fixed a warning in win/win_serial_passthrough.c. --- src/win/win_serial_passthrough.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/win/win_serial_passthrough.c b/src/win/win_serial_passthrough.c index 78ed1a766..cfe920aa7 100644 --- a/src/win/win_serial_passthrough.c +++ b/src/win/win_serial_passthrough.c @@ -166,7 +166,8 @@ static int open_pseudo_terminal(serial_passthrough_t *dev) { char ascii_pipe_name[1024] = { 0 }; - strncpy(ascii_pipe_name, dev->named_pipe, 1023); + strncpy(ascii_pipe_name, dev->named_pipe, sizeof(ascii_pipe_name)); + ascii_pipe_name[1023] = '\0'; dev->master_fd = (intptr_t) CreateNamedPipeA(ascii_pipe_name, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, 1, 65536, 65536, NMPWAIT_USE_DEFAULT_WAIT, NULL); if (dev->master_fd == (intptr_t) INVALID_HANDLE_VALUE) { wchar_t errorMsg[1024] = { 0 };