From fad6bac8e65f3ee58845312d0ce60571052fc2ab Mon Sep 17 00:00:00 2001 From: Peter Hunt Date: Wed, 13 Dec 2023 16:02:46 -0500 Subject: [PATCH] fix some issues flagged by SAST scan Signed-off-by: Peter Hunt --- src/conn_sock.c | 2 +- src/ctr_stdio.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/conn_sock.c b/src/conn_sock.c index 7efd1213..62a02266 100644 --- a/src/conn_sock.c +++ b/src/conn_sock.c @@ -263,7 +263,7 @@ static char *bind_unix_socket(char *socket_relative_name, int sock_type, mode_t int socket_fd = -1; /* get the parent_dir of the socket. We'll use this to get the location of the socket. */ - char *parent_dir = socket_parent_dir(use_full_attach_path, max_socket_path_len()); + _cleanup_free_ char *parent_dir = socket_parent_dir(use_full_attach_path, max_socket_path_len()); /* * To be able to access the location of the attach socket, without first creating the attach socket diff --git a/src/ctr_stdio.c b/src/ctr_stdio.c index 3fab66ac..f19c2d30 100644 --- a/src/ctr_stdio.c +++ b/src/ctr_stdio.c @@ -106,8 +106,8 @@ static void drain_log_buffers(stdpipe_t pipe) { /* We pass a single byte buffer because write_to_logs expects that there is one byte of capacity beyond the buflen that we specify */ - char buf; - write_to_logs(pipe, &buf, 0); + char buf[1]; + write_to_logs(pipe, buf, 0); } static bool read_stdio(int fd, stdpipe_t pipe, gboolean *eof)