From 0df40b43e8c3b3fb4db2d6af38de5a0944ff64e9 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 1 Aug 2025 12:44:59 -0400 Subject: [PATCH] serialqueue: Be sure sq->name is null terminated Signed-off-by: Kevin O'Connor --- klippy/chelper/serialqueue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/klippy/chelper/serialqueue.c b/klippy/chelper/serialqueue.c index 1af00b06..ed1215df 100644 --- a/klippy/chelper/serialqueue.c +++ b/klippy/chelper/serialqueue.c @@ -43,11 +43,11 @@ struct serialqueue { uint8_t need_sync; int input_pos; // Threading + char name[16]; pthread_t tid; pthread_mutex_t lock; // protects variables below pthread_cond_t cond; int receive_waiting; - char name[16]; // Baud / clock tracking int receive_window; double bittime_adjust, idle_time; @@ -634,6 +634,7 @@ serialqueue_alloc(int serial_fd, char serial_fd_type, int client_id sq->serial_fd_type = serial_fd_type; sq->client_id = client_id; strncpy(sq->name, name, sizeof(sq->name)); + sq->name[sizeof(sq->name)-1] = '\0'; int ret = pipe(sq->pipe_fds); if (ret)