[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-107-g100cfe0

[email protected] (Tim Ruehsen) Sat, 2 May 2020 06:38:18 -0400 (EDT)
Newsgroups gmane.comp.gnu.inetutils.cvs
Message-ID <[email protected]>
--===============2421688711292579001==
Content-Type: text/plain

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  100cfe0866b3aa60dd2cd78a379b1bfc691423f9 (commit)
      from  83cfe7afd39afd3dbd36bf7d6fecaf1af61e035a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=100cfe0866b3aa60dd2cd78a379b1bfc691423f9


commit 100cfe0866b3aa60dd2cd78a379b1bfc691423f9
Author: Tim Rühsen <[email protected]>
Date:   Sun Mar 1 11:51:53 2020 +0100

    telnet: Use memove for overlapping memory instead of strncpy

diff --git a/ChangeLog b/ChangeLog
index 96490b5..4fa4640 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2020-04-27  Tim Rühsen  <[email protected]>
+
+	telnet: Use memove for overlapping memory instead of strncpy.
+
+	Overlapping source and destination buffers are not supported
+	by strncpy and give undefined results.
+
+	7.24.2.3 of ISO/IEC 9899:201x:
+	"If  copying  takes  place  between  objects  thatoverlap,
+	the behavior is undefined."
+
+	* telnet/commands.c (cmds): Use memove for overlapping memory
+	instead of strncpy.
+
 2020-04-12  Mats Erik Andersson  <[email protected]>
 
 	whois: Delegation of IP and AS.
diff --git a/telnet/commands.c b/telnet/commands.c
index 29b2bfd..ca3010b 100644
--- a/telnet/commands.c
+++ b/telnet/commands.c
@@ -3108,11 +3108,11 @@ cmdrc (char *m1, char *m2)
 	  if (isspace (line[0]))
 	    continue;
 	  if (strncasecmp (line, m1, l1) == 0)
-	    strncpy (line, &line[l1], sizeof (line) - l1);
+	    memmove (line, &line[l1], strlen(&line[l1]) + 1);
 	  else if (strncasecmp (line, m2, l2) == 0)
-	    strncpy (line, &line[l2], sizeof (line) - l2);
+	    memmove (line, &line[l2], strlen(&line[l2]) + 1);
 	  else if (strncasecmp (line, "DEFAULT", 7) == 0)
-	    strncpy (line, &line[7], sizeof (line) - 7);
+	    memmove (line, &line[7], strlen(&line[7]) + 1);
 	  else
 	    continue;
 	  if (line[0] != ' ' && line[0] != '\t' && line[0] != '\n')

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         | 14 ++++++++++++++
 telnet/commands.c |  6 +++---
 2 files changed, 17 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


--===============2421688711292579001==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KQ29tbWl0LWlu
ZXR1dGlscyBtYWlsaW5nIGxpc3QKQ29tbWl0LWluZXR1dGlsc0BnbnUub3JnCmh0dHBzOi8vbGlz
dHMuZ251Lm9yZy9tYWlsbWFuL2xpc3RpbmZvL2NvbW1pdC1pbmV0dXRpbHMK

--===============2421688711292579001==--