Blame SOURCES/0014-libssh2-1.4.3-scp-remote-exec.patch

096905
From 9506e299fa5116aa8c4c626e6de1feaed9ff9ff8 Mon Sep 17 00:00:00 2001
096905
From: Kamil Dudka <kdudka@redhat.com>
096905
Date: Mon, 11 Sep 2017 21:13:45 +0200
d780b0
Subject: [PATCH] scp: do not NUL-terminate the command for remote exec (#208)
096905
096905
It breaks SCP download/upload from/to certain server implementations.
096905
096905
The bug does not manifest with OpenSSH, which silently drops the NUL
096905
byte (eventually with any garbage that follows the NUL byte) before
096905
executing it.
096905
096905
Bug: https://bugzilla.redhat.com/1489736
096905
096905
Upstream-commit: 819ef4f2037490b6aa2e870aea851b6364184090
096905
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
096905
---
096905
 src/scp.c | 8 ++++----
096905
 1 file changed, 4 insertions(+), 4 deletions(-)
096905
096905
diff --git a/src/scp.c b/src/scp.c
096905
index f3d4995..c6451bc 100644
096905
--- a/src/scp.c
096905
+++ b/src/scp.c
d780b0
@@ -303,8 +303,8 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, libssh2_struct_stat * sb)
096905
                                   &session->scpRecv_command[cmd_len],
096905
                                   session->scpRecv_command_len - cmd_len);
096905
 
096905
-        session->scpRecv_command[cmd_len] = '\0';
096905
-        session->scpRecv_command_len = cmd_len + 1;
096905
+        /* the command to exec should _not_ be NUL-terminated */
096905
+        session->scpRecv_command_len = cmd_len;
096905
 
096905
         _libssh2_debug(session, LIBSSH2_TRACE_SCP,
096905
                        "Opening channel for SCP receive");
d780b0
@@ -845,8 +845,8 @@ scp_send(LIBSSH2_SESSION * session, const char *path, int mode,
096905
                                   &session->scpSend_command[cmd_len],
096905
                                   session->scpSend_command_len - cmd_len);
096905
 
096905
-        session->scpSend_command[cmd_len] = '\0';
096905
-        session->scpSend_command_len = cmd_len + 1;
096905
+        /* the command to exec should _not_ be NUL-terminated */
096905
+        session->scpSend_command_len = cmd_len;
096905
 
096905
         _libssh2_debug(session, LIBSSH2_TRACE_SCP,
096905
                        "Opening channel for SCP send");
096905
-- 
096905
2.13.5
096905