From: dtucker@openbsd.org Date: Wed, 19 Mar 2025 06:11:15 +0000 (+0000) Subject: upstream: Prevent theoretical NULL deref in throughlocal_sftp. X-Git-Tag: V_10_0_P1~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b311b6b17be81577514c38e8be4f5740d7df496;p=thirdparty%2Fopenssh-portable.git upstream: Prevent theoretical NULL deref in throughlocal_sftp. Coverity CID 405019, although at the moment it's not reachable. ok djm@ OpenBSD-Commit-ID: 630d46c1021b69fbb470e349976c70e9a48b7644 --- diff --git a/scp.c b/scp.c index 0779c3c2b..d12cf6df8 100644 --- a/scp.c +++ b/scp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scp.c,v 1.261 2024/06/26 23:14:14 deraadt Exp $ */ +/* $OpenBSD: scp.c,v 1.262 2025/03/19 06:11:15 dtucker Exp $ */ /* * scp - secure remote copy. This is basically patched BSD rcp which * uses ssh to do the data transfer (instead of using rcmd). @@ -1085,7 +1085,7 @@ toremote(int argc, char **argv, enum scp_mode_e mode, char *sftp_direct) } if (host && throughlocal) { /* extended remote to remote */ if (mode == MODE_SFTP) { - if (remin == -1) { + if (remin == -1 || conn == NULL) { /* Connect to dest now */ conn = do_sftp_connect(thost, tuser, tport, sftp_direct,