Skip to content

Commit 6f0308a

Browse files
committed
upstream: Return immediately from get_sock_port
if sock <0 so we don't call getsockname on a negative FD. From Coverity CID 291840, ok djm@ OpenBSD-Commit-ID: de1c1130646230c2eda559831fc6bfd1b61d9618
1 parent 1c1124d commit 6f0308a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

canohost.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: canohost.c,v 1.76 2023/03/03 05:00:34 djm Exp $ */
1+
/* $OpenBSD: canohost.c,v 1.77 2023/03/31 04:42:29 dtucker Exp $ */
22
/*
33
* Author: Tatu Ylonen <[email protected]>
44
* Copyright (c) 1995 Tatu Ylonen <[email protected]>, Espoo, Finland
@@ -163,6 +163,8 @@ get_sock_port(int sock, int local)
163163
char strport[NI_MAXSERV];
164164
int r;
165165

166+
if (sock < 0)
167+
return -1;
166168
/* Get IP address of client. */
167169
fromlen = sizeof(from);
168170
memset(&from, 0, sizeof(from));

0 commit comments

Comments
 (0)