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
This commit is contained in:
dtucker@openbsd.org
2025-03-19 06:11:15 +00:00
committed by Darren Tucker
parent 96493ebd6f
commit 1b311b6b17

4
scp.c
View File

@@ -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,