From 5f61c2a34a00440293611e08094f9038a5068890 Mon Sep 17 00:00:00 2001 From: Zoltan Fridrich Date: Wed, 1 Apr 2026 16:13:04 +0200 Subject: [PATCH] Fix static analysis issues Resolves: RHEL-163366 Signed-off-by: Zoltan Fridrich --- openssh-6.7p1-coverity.patch | 165 ++++++++++++++++++++++++++++++++++- openssh.spec | 11 ++- 2 files changed, 170 insertions(+), 6 deletions(-) diff --git a/openssh-6.7p1-coverity.patch b/openssh-6.7p1-coverity.patch index ffe0c69..33dbb20 100644 --- a/openssh-6.7p1-coverity.patch +++ b/openssh-6.7p1-coverity.patch @@ -159,7 +159,47 @@ diff -up openssh-8.7p1/openbsd-compat/bsd-pselect.c.coverity openssh-8.7p1/openb diff -up openssh-8.5p1/readconf.c.coverity openssh-8.5p1/readconf.c --- openssh-8.5p1/readconf.c.coverity 2021-03-24 12:03:33.778968131 +0100 +++ openssh-8.5p1/readconf.c 2021-03-24 12:03:33.785968180 +0100 -@@ -1847,6 +1847,7 @@ parse_pubkey_algos: +@@ -749,12 +749,12 @@ match_cfg_line(Options *options, const c + debug2("checking match for '%s' host %s originally %s", + full_line, host, original_host); + while ((attrib = argv_next(acp, avp)) != NULL) { +- attrib = oattrib = xstrdup(attrib); + /* Terminate on comment */ + if (*attrib == '#') { + argv_consume(acp); + break; + } ++ attrib = oattrib = xstrdup(attrib); + arg = criteria = NULL; + this_result = 1; + if ((negate = (attrib[0] == '!'))) +@@ -793,7 +793,7 @@ match_cfg_line(Options *options, const c + debug3("%.200s line %d: %smatched '%s'", + filename, linenum, + this_result ? "" : "not ", oattrib); +- continue; ++ goto next; + } + + /* Keep this list in sync with below */ +@@ -863,7 +863,7 @@ match_cfg_line(Options *options, const c + debug3("%.200s line %d: skipped exec " + "\"%.100s\"", filename, linenum, cmd); + free(cmd); +- continue; ++ goto next; + } + r = execute_in_shell(cmd); + if (r == -1) { +@@ -887,6 +887,7 @@ match_cfg_line(Options *options, const c + criteria == NULL ? "" : " \"", + criteria == NULL ? "" : criteria, + criteria == NULL ? "" : "\""); ++next: + free(criteria); + free(oattrib); + oattrib = attrib = NULL; +@@ -1847,6 +1848,7 @@ parse_pubkey_algos: } else if (r != 0) { error("%.200s line %d: glob failed for %s.", filename, linenum, arg2); @@ -170,7 +210,109 @@ diff -up openssh-8.5p1/readconf.c.coverity openssh-8.5p1/readconf.c diff -up openssh-7.4p1/servconf.c.coverity openssh-7.4p1/servconf.c --- openssh-7.4p1/servconf.c.coverity 2016-12-23 16:40:26.896788690 +0100 +++ openssh-7.4p1/servconf.c 2016-12-23 16:40:26.901788691 +0100 -@@ -1638,8 +1638,9 @@ process_server_config_line(ServerOptions +@@ -1104,12 +1104,12 @@ match_cfg_line(const char *full_line, in + } + + while ((oattrib = argv_next(acp, avp)) != NULL) { +- attrib = xstrdup(oattrib); + /* Terminate on comment */ +- if (*attrib == '#') { ++ if (*oattrib == '#') { + argv_consume(acp); /* mark all arguments consumed */ + break; + } ++ attrib = xstrdup(oattrib); + arg = NULL; + attributes++; + /* Criterion "all" has no argument and must appear alone */ +@@ -1131,13 +1131,13 @@ match_cfg_line(const char *full_line, in + if (strcasecmp(attrib, "invalid-user") == 0) { + if (ci == NULL) { + result = 0; +- continue; ++ goto next; + } + if (ci->user_invalid == 0) + result = 0; + else + debug("matched invalid-user at line %d", line); +- continue; ++ goto next; + } + + /* Keep this list in sync with below */ +@@ -1163,7 +1163,7 @@ match_cfg_line(const char *full_line, in + if (strcasecmp(attrib, "user") == 0) { + if (ci == NULL || (ci->test && ci->user == NULL)) { + result = 0; +- continue; ++ goto next; + } + if (ci->user == NULL) + match_test_missing_fatal("User", "user"); +@@ -1175,7 +1175,7 @@ match_cfg_line(const char *full_line, in + } else if (strcasecmp(attrib, "group") == 0) { + if (ci == NULL || (ci->test && ci->user == NULL)) { + result = 0; +- continue; ++ goto next; + } + if (ci->user == NULL) + match_test_missing_fatal("Group", "user"); +@@ -1189,7 +1189,7 @@ match_cfg_line(const char *full_line, in + } else if (strcasecmp(attrib, "host") == 0) { + if (ci == NULL || (ci->test && ci->host == NULL)) { + result = 0; +- continue; ++ goto next; + } + if (ci->host == NULL) + match_test_missing_fatal("Host", "host"); +@@ -1204,7 +1204,7 @@ match_cfg_line(const char *full_line, in + fatal("Invalid Match address argument " + "'%s' at line %d", arg, line); + result = 0; +- continue; ++ goto next; + } + if (ci->address == NULL) + match_test_missing_fatal("Address", "addr"); +@@ -1228,7 +1228,7 @@ match_cfg_line(const char *full_line, in + "argument '%s' at line %d", arg, + line); + result = 0; +- continue; ++ goto next; + } + if (ci->laddress == NULL) + match_test_missing_fatal("LocalAddress", +@@ -1256,7 +1256,7 @@ match_cfg_line(const char *full_line, in + } + if (ci == NULL || (ci->test && ci->lport == -1)) { + result = 0; +- continue; ++ goto next; + } + if (ci->lport == 0) + match_test_missing_fatal("LocalPort", "lport"); +@@ -1270,7 +1270,7 @@ match_cfg_line(const char *full_line, in + } else if (strcasecmp(attrib, "rdomain") == 0) { + if (ci == NULL || (ci->test && ci->rdomain == NULL)) { + result = 0; +- continue; ++ goto next; + } + if (ci->rdomain == NULL) + match_test_missing_fatal("RDomain", "rdomain"); +@@ -1284,6 +1284,7 @@ match_cfg_line(const char *full_line, in + result = -1; + goto out; + } ++next: + free(attrib); + attrib = NULL; + } +@@ -1638,8 +1639,9 @@ process_server_config_line(ServerOptions if (*activep && *charptr == NULL) { *charptr = tilde_expand_filename(arg, getuid()); /* increase optional counter */ @@ -246,3 +388,22 @@ diff -up openssh-8.5p1/ssh-keygen.c.coverity openssh-8.5p1/ssh-keygen.c } else { if (strncasecmp(cp, "key:", 4) == 0) { cp += 4; +diff -up openssh-9.9p1/sshd.c.coverity openssh-9.9p1/sshd.c +--- openssh-9.9p1/sshd.c.coverity 2026-04-08 15:19:20.480015568 +0200 ++++ openssh-9.9p1/sshd.c 2026-04-08 15:22:10.938328556 +0200 +@@ -1069,6 +1069,7 @@ server_accept_loop(int *sock_in, int *so + send_rexec_state(config_s[0], cfg); + close(config_s[0]); + free(pfd); ++ free(startup_pollfd); + return; + } + +@@ -1101,6 +1102,7 @@ server_accept_loop(int *sock_in, int *so + log_stderr); + close(config_s[0]); + free(pfd); ++ free(startup_pollfd); + return; + } + diff --git a/openssh.spec b/openssh.spec index 2643cc5..90f9bc9 100644 --- a/openssh.spec +++ b/openssh.spec @@ -47,7 +47,7 @@ # Do not forget to bump pam_ssh_agent_auth release if you rewind the main package release to 1 %global openssh_ver 9.9p1 -%global openssh_rel 7 +%global openssh_rel 8 %global pam_ssh_agent_ver 0.10.4 %global pam_ssh_agent_rel 9 @@ -440,9 +440,6 @@ popd %patch1002 -p1 -b .ssh-manpage %patch1006 -p1 -b .negotiate-supported-algs - -%patch100 -p1 -b .coverity - %patch1007 -p1 -b .sshrsacheck %patch1012 -p1 -b .evp-fips-kex %patch1015 -p1 -b .pam-rhost @@ -464,6 +461,8 @@ popd %patch1038 -p1 -b .reject-null-char-in-url-string %patch1039 -p1 -b .skip-mlkem-when-na +%patch100 -p1 -b .coverity + autoreconf pushd pam_ssh_agent_auth-pam_ssh_agent_auth-%{pam_ssh_agent_ver} autoreconf @@ -751,6 +750,10 @@ test -f %{sysconfig_anaconda} && \ %endif %changelog +* Wed Apr 01 2026 Zoltan Fridrich - 9.9p1-8 +- Fix static analysis issues + Resolves: RHEL-163366 + * Thu Mar 26 2026 Zoltan Fridrich - 9.9p1-7 + 0.10.4-9 - Version bump