bash-custom-action/bash-memmove.patch
2018-07-10 09:59:35 +00:00

20 lines
614 B
Diff

Author: Bernhard M. Wiedemann <bwiedemann suse de>
Date: 2018-07-07
strcpy can cause corruption when working on overlapping strings
so we use memmove instead that handles this case correctly
Index: bash-4.4/support/man2html.c
===================================================================
--- bash-4.4.orig/support/man2html.c
+++ bash-4.4/support/man2html.c
@@ -1992,7 +1993,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;