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 

_______________________________________________
Commit-inetutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/commit-inetutils

Reply via email to