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>
Jeff King committed
Feb 8, 2016 at 17:21 UTC
7b11a18a2ee04380c1c698635f1ef2c4eb3324fb
1 file changed
+1
-1
test-path-utils.c
+1
-1
@@ -56,7 +56,7 @@ static int test_function(struct test_data *data, char *(*func)(char *input),
56
if (!data[i].from)
57
to = func(NULL);
58
else {
59
- strcpy(buffer, data[i].from);
59
+ xsnprintf(buffer, sizeof(buffer), "%s", data[i].from);
60
to = func(buffer);
61
}
62
if (!strcmp(to, data[i].to))