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

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