Blame SOURCES/0001-scp-do-not-NUL-terminate-the-command-for-remote-exec.patch

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