From 3eb51ce94f8a49baa2394d500c82183308d1a287 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Wed, 29 Jul 2020 18:35:44 +0200 Subject: [PATCH] serial_win.c: Copy the enough of the device name. --- src/platforms/pc/serial_win.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platforms/pc/serial_win.c b/src/platforms/pc/serial_win.c index 19a3a9f..4b02e36 100644 --- a/src/platforms/pc/serial_win.c +++ b/src/platforms/pc/serial_win.c @@ -34,11 +34,11 @@ int serial_open(BMP_CL_OPTIONS_t *cl_opts, char * serial) } char device[256]; if (strstr(device, "\\\\.\\")) { - strncpy(device, cl_opts->opt_device, sizeof(cl_opts->opt_device) - 1); + strncpy(device, cl_opts->opt_device, sizeof(device) - 1); } else { strcpy(device, "\\\\.\\"); strncat(device, cl_opts->opt_device, - sizeof(cl_opts->opt_device) - strlen(cl_opts->opt_device) - 1); + sizeof(device) - strlen(device) - 1); } hComm = CreateFile(device, //port name GENERIC_READ | GENERIC_WRITE, //Read/Write