summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2020-05-25 21:21:41 +0200
committerDominique Martinet <asmadeus@codewreck.org>2020-05-25 21:21:41 +0200
commit6857555e47b909076f47a74fa580a26c62f4d791 (patch)
tree248b295cdeb63c538127b220a02b483a149ae11d
parenta16350f2c0eb4290c3a6324ee0699aba50875c89 (diff)
fdgrab: replace_str: change strcpy to memmov
strcpy apparently isn't overlap-safe (says ASAN)
-rw-r--r--fdgrab.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fdgrab.c b/fdgrab.c
index 2cabc23..bec219f 100644
--- a/fdgrab.c
+++ b/fdgrab.c
@@ -14,7 +14,9 @@ static void replace_str(const char *orig, char **arg, char *pattern, char *repla
search = out;
}
memmove(out + (found - search), replace, strlen(replace));
- strcpy(out + (found - search) + strlen(replace), out + (found - search) + strlen(pattern));
+ memmove(out + (found - search) + strlen(replace),
+ out + (found - search) + strlen(pattern),
+ strlen(out + (found - search) + strlen(pattern)) + 1);
}
}