1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-24 04:56:09 +02:00

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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2016-02-08 17:21:55 -05:00 committed by Junio C Hamano
parent e01c6b15c9
commit 7b11a18a2e

View File

@ -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))