telnet/netkit-telnet-0.17-telnetrc.patch
Michal Ruprich a88283db8c Resolves: #1606506 - telnet: FTBFS in Fedora rawhide
Resolves: #1505954 - telnet failing to parse .telnetrc due to strncpy used on overlaping buffers
2018-07-23 13:18:59 +02:00

20 lines
734 B
Diff

diff --git a/telnet/commands.c b/telnet/commands.c
index 636fb5c..c0cc9b9 100644
--- a/telnet/commands.c
+++ b/telnet/commands.c
@@ -2217,11 +2217,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], sizeof(line) - l1);
else if (strncasecmp(line, m2, l2) == 0)
- strncpy(line, &line[l2], sizeof(line) - l2);
+ memmove(line, &line[l2], sizeof(line) - l2);
else if (strncasecmp(line, "DEFAULT", 7) == 0)
- strncpy(line, &line[7], sizeof(line) - 7);
+ memmove(line, &line[7], sizeof(line) - 7);
else
continue;
if (line[0] != ' ' && line[0] != '\t' && line[0] != '\n')