From: Jeff King Date: Mon, 8 Feb 2016 22:21:55 +0000 (-0500) Subject: test-path-utils: use xsnprintf in favor of strcpy X-Git-Tag: v2.8.0-rc0~50^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7b11a18a2ee04380c1c698635f1ef2c4eb3324fb;p=git-core%2Fgit.git test-path-utils: use xsnprintf in favor of strcpy 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 Signed-off-by: Junio C Hamano --- diff --git a/test-path-utils.c b/test-path-utils.c index c3adcd87b..6232dfe66 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))