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)