]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: Prevent theoretical NULL deref in throughlocal_sftp.
authordtucker@openbsd.org <dtucker@openbsd.org>
Wed, 19 Mar 2025 06:11:15 +0000 (06:11 +0000)
committerDarren Tucker <dtucker@dtucker.net>
Wed, 19 Mar 2025 06:41:29 +0000 (17:41 +1100)
Coverity CID 405019, although at the moment it's not reachable. ok djm@

OpenBSD-Commit-ID: 630d46c1021b69fbb470e349976c70e9a48b7644

scp.c

diff --git a/scp.c b/scp.c
index 0779c3c2b7c4b0765ce0dedcc560a13831c8952f..d12cf6df8b7a7b232195a513f917cb308c69b1e9 100644 (file)
--- 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,