File openssh-7.2p2-audit_fixes.patch of Package openssh.29886
From 5b12971f91aee6e2b5e510ee2c1c5c0a47a129a1 Mon Sep 17 00:00:00 2001
From: Old openssh patches <pcerny@suse.com>
Date: Wed, 26 Oct 2022 09:51:34 +0200
Subject: [PATCH] openssh-7.2p2-audit_fixes
# HG changeset patch
# Parent fdc9167221e501a9f4db5343cf8cadc31e13fd56
Various auditing fixes to be merged into the RH-originated patch.
---
packet.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/packet.c b/packet.c
index 39570537..4c17c2c4 100644
--- a/packet.c
+++ b/packet.c
@@ -376,10 +376,16 @@ ssh_packet_start_discard(struct ssh *ssh, struct sshenc *enc,
int
ssh_packet_connection_is_on_socket(struct ssh *ssh)
{
- struct session_state *state = ssh->state;
+ struct session_state *state;
struct sockaddr_storage from, to;
socklen_t fromlen, tolen;
+ /* auditing might get here without valid connection structure when
+ * destroying sensitive data on exit and thus aborting disgracefully */
+ if ((!ssh) || (!(ssh->state)))
+ return 0;
+ state = ssh->state;
+
/* filedescriptors in and out are the same, so it's a socket */
if (state->connection_in == state->connection_out)
return 1;
--
2.38.0