summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-02-08 17:21:55 -0500
committerJunio C Hamano <gitster@pobox.com>2016-02-08 14:42:32 -0800
commit7b11a18a2ee04380c1c698635f1ef2c4eb3324fb (patch)
tree01dec3bb08d3a5117c1a8fdae17642f9690eb403
parente01c6b15c97e30baedc45021e6dcbd90140616cd (diff)
downloadgit-jk/test-path-utils-xsnprintf.tar.gz
test-path-utils: use xsnprintf in favor of strcpyjk/test-path-utils-xsnprintf
This strcpy will never overflow because it's copying from baked-in test data. But we would prefer to avoid strcpy entirely, as it makes it harder to audit for real security bugs. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--test-path-utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/test-path-utils.c b/test-path-utils.c
index c3adcd87b8..6232dfe661 100644
--- a/test-path-utils.c
+++ b/test-path-utils.c
@@ -56,7 +56,7 @@ static int test_function(struct test_data *data, char *(*func)(char *input),
if (!data[i].from)
to = func(NULL);
else {
- strcpy(buffer, data[i].from);
+ xsnprintf(buffer, sizeof(buffer), "%s", data[i].from);
to = func(buffer);
}
if (!strcmp(to, data[i].to))