mirror of
https://github.com/andreili/klipper.git
synced 2025-08-23 19:34:06 +02:00
serialqueue: Be sure sq->name is null terminated
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
17ce45d212
commit
0df40b43e8
@ -43,11 +43,11 @@ struct serialqueue {
|
|||||||
uint8_t need_sync;
|
uint8_t need_sync;
|
||||||
int input_pos;
|
int input_pos;
|
||||||
// Threading
|
// Threading
|
||||||
|
char name[16];
|
||||||
pthread_t tid;
|
pthread_t tid;
|
||||||
pthread_mutex_t lock; // protects variables below
|
pthread_mutex_t lock; // protects variables below
|
||||||
pthread_cond_t cond;
|
pthread_cond_t cond;
|
||||||
int receive_waiting;
|
int receive_waiting;
|
||||||
char name[16];
|
|
||||||
// Baud / clock tracking
|
// Baud / clock tracking
|
||||||
int receive_window;
|
int receive_window;
|
||||||
double bittime_adjust, idle_time;
|
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->serial_fd_type = serial_fd_type;
|
||||||
sq->client_id = client_id;
|
sq->client_id = client_id;
|
||||||
strncpy(sq->name, name, sizeof(sq->name));
|
strncpy(sq->name, name, sizeof(sq->name));
|
||||||
|
sq->name[sizeof(sq->name)-1] = '\0';
|
||||||
|
|
||||||
int ret = pipe(sq->pipe_fds);
|
int ret = pipe(sq->pipe_fds);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user