[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Use memmove instead of strcpy
From: |
Bernhard M. Wiedemann |
Subject: |
[PATCH] Use memmove instead of strcpy |
Date: |
Sat, 7 Jul 2018 07:25:52 +0200 |
In https://bugzilla.opensuse.org/show_bug.cgi?id=1100488
we found that depending on the build machine, bash-4.4's bash.html would
contain the string Bahh instead of Bash
strcpy can cause corruption when working on overlapping strings
so we use memmove instead that handles this case correctly
---
support/man2html.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/support/man2html.c b/support/man2html.c
index 6ba50616..f56a8945 100644
--- a/support/man2html.c
+++ b/support/man2html.c
@@ -1992,7 +1992,7 @@ unescape (char *c)
while (i < l && c[i]) {
if (c[i] == '\a') {
if (c[i+1])
- strcpy(c + i, c + i + 1); /* should be
memmove */
+ memmove(c + i, c + i + 1, strlen(c + i));
else {
c[i] = '\0';
break;
--
2.13.7
- [PATCH] Use memmove instead of strcpy,
Bernhard M. Wiedemann <=