See attached. Also added to my smb3-utils repo on github If any objections or review comments, let us know. -- Thanks, Steve
From aa5666a3aa808d1c4d3374192c68fef4f4a3d3a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Filipensk=C3=BD?= <pfilipensky@xxxxxxxxx> Date: Wed, 9 Oct 2024 12:39:23 +0200 Subject: [PATCH 2/2] resolve_host.c: Initialize site_name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit reported by Red Hat code analyzer: cifs-utils-7.1/resolve_host.c:188:3: uninit_use_in_call: Using uninitialized value "*site_name" as argument to "%s" when calling "snprintf". Signed-off-by: Pavel Filipenský <pfilipensky@xxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> --- resolve_host.c | 1 + 1 file changed, 1 insertion(+) diff --git a/resolve_host.c b/resolve_host.c index fc682e5..918c6ad 100644 --- a/resolve_host.c +++ b/resolve_host.c @@ -147,6 +147,7 @@ int resolve_host(const char *host, char *addrstr) { goto resolve_host_out; char site_name[MAXCDNAME]; + site_name[0] = '\0'; // We assume that AD always sends the ip addresses in the addtional data block for (int i = 0; i < ns_msg_count(global_domain_handle, ns_s_ar); i++) { ns_rr rr; -- 2.43.0
From 901409a2ef6bb5b72a6f774713f754ec7cc3eca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Filipensk=C3=BD?= <pfilipensky@xxxxxxxxx> Date: Wed, 9 Oct 2024 12:37:12 +0200 Subject: [PATCH 1/2] cldap_ping: Fix socket fd leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit reported by Red Hat code analyzer: cifs-utils-7.1/cldap_ping.c:323:3: leaked_handle: Handle variable "sock" going out of scope leaks the handle. Signed-off-by: Pavel Filipenský <pfilipensky@xxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> --- cldap_ping.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cldap_ping.c b/cldap_ping.c index a603be3..5c20f84 100644 --- a/cldap_ping.c +++ b/cldap_ping.c @@ -318,9 +318,11 @@ int cldap_ping(char *domain, sa_family_t family, void *addr, char *site_name) { struct timeval timeout = {.tv_sec = 2, .tv_usec = 0}; if (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)) < 0) { + close(sock); return CLDAP_PING_NETWORK_ERROR; } if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)) < 0) { + close(sock); return CLDAP_PING_NETWORK_ERROR; } -- 2.43.0