From c4e510c967d63fd5f52e95d91449a64b0d5a18a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
Date: Sat, 29 Feb 2020 18:57:47 +0100
Subject: [PATCH 41/60] ftp: Fix 2x misuse of strncpy (read buffer overflow)

---
 ftp/ftp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ftp/ftp.c b/ftp/ftp.c
index d3726069..604d3e55 100644
--- a/ftp/ftp.c
+++ b/ftp/ftp.c
@@ -1726,10 +1726,10 @@ pswitch (int flag)
   ip->ntflg = ntflag;
   ntflag = op->ntflg;
   strncpy (ip->nti, ntin, sizeof (ntin) - 1);
-  (ip->nti)[strlen (ip->nti)] = '\0';
+  (ip->nti)[sizeof (ntin) - 1] = '\0';
   strcpy (ntin, op->nti);
   strncpy (ip->nto, ntout, sizeof (ntout) - 1);
-  (ip->nto)[strlen (ip->nto)] = '\0';
+  (ip->nto)[sizeof (ntout) - 1] = '\0';
   strcpy (ntout, op->nto);
   ip->mapflg = mapflag;
   mapflag = op->mapflg;
-- 
2.26.0.292.g33ef6b2f38

