subreader: remove overlapping strcpy

Looks like this relied on undefined behavior.
This commit is contained in:
wm4 2013-12-22 23:44:24 +01:00
parent aefb100e68
commit 90e4c85891
1 changed files with 2 additions and 1 deletions

View File

@ -127,7 +127,8 @@ static int eol(char p) {
static void trail_space(char *s) {
int i = 0;
while (isspace(s[i])) ++i;
if (i) strcpy(s, s + i);
int copylen = strlen(s + i);
if (i) memmove(s, s + i, copylen);
i = strlen(s) - 1;
while (i > 0 && isspace(s[i])) s[i--] = '\0';
}