a88283db8c
Resolves: #1505954 - telnet failing to parse .telnetrc due to strncpy used on overlaping buffers
20 lines
734 B
Diff
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')
|