Commit 0750d0cc by Patrick Steinhardt

tests: refs::normalize: simplify code to avoid GCC warning

Since version 8.1, GCC will do some automatic bounds checking
when printing static content into a buffer with known size. The
bounds checking doesn't yet work quite right in all scenarios and
may thus lead to false positives. Fix one of these false
positives in refs::normalize by simplifying the code.
parent ba5e39ac
......@@ -193,10 +193,7 @@ void test_refs_normalize__jgit_suite(void)
char c;
char buffer[GIT_REFNAME_MAX];
for (c = '\1'; c < ' '; c++) {
strncpy(buffer, "refs/heads/mast", 15);
strncpy(buffer + 15, (const char *)&c, 1);
strncpy(buffer + 16, "er", 2);
buffer[18 - 1] = '\0';
p_snprintf(buffer, sizeof(buffer), "refs/heads/mast%cer", c);
ensure_refname_invalid(GIT_REF_FORMAT_ALLOW_ONELEVEL, buffer);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment