diff options
author | djm@openbsd.org <djm@openbsd.org> | 2023-03-03 06:00:34 +0100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2023-03-03 06:12:05 +0100 |
commit | 1842d523fae63b862ce8e60725c9b606cddb86a6 (patch) | |
tree | 83e187d6b90b52b761515d85a4dad989fbb1b1d1 /canohost.c | |
parent | upstream: some options are not first-match-wins. Mention that there (diff) | |
download | openssh-1842d523fae63b862ce8e60725c9b606cddb86a6.tar.xz openssh-1842d523fae63b862ce8e60725c9b606cddb86a6.zip |
upstream: guard against getsockname(-1, ...) from Coverity CID
291832
OpenBSD-Commit-ID: e58d5227327917d189229b7f0b37d2780f360d5f
Diffstat (limited to 'canohost.c')
-rw-r--r-- | canohost.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/canohost.c b/canohost.c index a810da0ee..457e9097e 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@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@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)); |