Merge branch 'jk/test-path-utils-xsnprintf'
authorJunio C Hamano <gitster@pobox.com>
Wed, 17 Feb 2016 18:13:32 +0000 (10:13 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 17 Feb 2016 18:13:32 +0000 (10:13 -0800)
Some calls to strcpy(3) triggers a false warning from static
analysers that are less intelligent than humans, and reducing the
number of these false hits helps us notice real issues. A few
calls to strcpy(3) in test-path-utils that are already safe has
been rewritten to avoid false wanings.

* jk/test-path-utils-xsnprintf:
test-path-utils: use xsnprintf in favor of strcpy

test-path-utils.c
index c3adcd87b8caa2028785483bbc01d85fd0f7a9d6..6232dfe661a53d1eaf17ead5133da5792ae2413f 100644 (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))