[openssh-commits] [openssh] 03/03: upstream: guard against getsockname(-1, ...) from Coverity CID

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Mar 3 16:12:14 AEDT 2023


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 1842d523fae63b862ce8e60725c9b606cddb86a6
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Fri Mar 3 05:00:34 2023 +0000

    upstream: guard against getsockname(-1, ...) from Coverity CID
    
    291832
    
    OpenBSD-Commit-ID: e58d5227327917d189229b7f0b37d2780f360d5f
---
 canohost.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/canohost.c b/canohost.c
index a810da0e..457e9097 100644
--- a/canohost.c
+++ b/canohost.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: canohost.c,v 1.75 2020/10/18 11:32:01 djm Exp $ */
+/* $OpenBSD: canohost.c,v 1.76 2023/03/03 05:00:34 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -72,6 +72,9 @@ get_socket_address(int sock, int remote, int flags)
 	char ntop[NI_MAXHOST];
 	int r;
 
+	if (sock < 0)
+		return NULL;
+
 	/* Get IP address of client. */
 	addrlen = sizeof(addr);
 	memset(&addr, 0, sizeof(addr));

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list