Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14298
| From | "Bernhard M. Wiedemann" <bwiedemann@suse.de> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | [PATCH] Use memmove instead of strcpy |
| Date | 2018-07-07 08:04 +0200 |
| Message-ID | <mailman.3181.1530946633.1292.bug-bash@gnu.org> (permalink) |
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
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
[PATCH] Use memmove instead of strcpy "Bernhard M. Wiedemann" <bwiedemann@suse.de> - 2018-07-07 08:04 +0200
csiph-web