The following issues were found
t/helper/test-repository.c
1 issues
Line: 32
Column: 2
CWE codes:
134
Suggestion:
Use a constant for the format specification
if (!parse_commit_in_graph(&r, c))
die("Couldn't parse commit");
printf("%"PRItime, c->date);
for (parent = c->parents; parent; parent = parent->next)
printf(" %s", oid_to_hex(&parent->item->object.oid));
printf("\n");
repo_clear(&r);
Reported by FlawFinder.
builtin/commit-tree.c
1 issues
Line: 91
Column: 8
CWE codes:
362
if (!strcmp(arg, "-"))
fd = 0;
else {
fd = open(arg, O_RDONLY);
if (fd < 0)
die_errno(_("git commit-tree: failed to open '%s'"), arg);
}
if (strbuf_read(buf, fd, 0) < 0)
die_errno(_("git commit-tree: failed to read '%s'"), arg);
Reported by FlawFinder.
t/helper/test-windows-named-pipe.c
1 issues
Line: 17
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
int err;
HANDLE h;
BOOL connected;
char buf[TEST_BUFSIZE + 1];
if (argc < 2)
goto print_usage;
filename = argv[1];
if (strpbrk(filename, "/\\"))
Reported by FlawFinder.
t/helper/test-xml-encode.c
1 issues
Line: 11
Column: 11
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
*/
int cmd__xml_encode(int argc, const char **argv)
{
unsigned char buf[1024], tmp[4], *tmp2 = NULL;
ssize_t cur = 0, len = 1, remaining = 0;
unsigned char ch;
for (;;) {
if (++cur == len) {
Reported by FlawFinder.
t/t4051/appended1.c
1 issues
Line: 3
int appended(void) // Begin of first part
{
int i;
char *s = "a string";
printf("%s\n", s);
for (i = 99;
Reported by Cppcheck.
t/t4051/appended2.c
1 issues
Line: 35
*/
return 0;
} // End of second part
Reported by Cppcheck.
builtin/check-ref-format.c
1 issues
Line: 23
Column: 23
CWE codes:
126
*/
static char *collapse_slashes(const char *refname)
{
char *ret = xmallocz(strlen(refname));
char ch;
char prev = '/';
char *cp = ret;
while ((ch = *refname++) != '\0') {
Reported by FlawFinder.
tmp-objdir.c
1 issues
Line: 98
Column: 8
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
val = quoted.buf;
}
old = getenv(key);
if (!old)
strvec_pushf(env, "%s=%s", key, val);
else
strvec_pushf(env, "%s=%s%c%s", key, old, PATH_SEP, val);
Reported by FlawFinder.
builtin/check-mailmap.c
1 issues
Line: 24
Column: 40
CWE codes:
126
size_t namelen, maillen;
struct ident_split ident;
if (split_ident_line(&ident, contact, strlen(contact)))
die(_("unable to parse contact: %s"), contact);
name = ident.name_begin;
namelen = ident.name_end - ident.name_begin;
mail = ident.mail_begin;
Reported by FlawFinder.
builtin/check-ignore.c
1 issues
Line: 131
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
{
struct strbuf buf = STRBUF_INIT;
struct strbuf unquoted = STRBUF_INIT;
char *pathspec[2] = { NULL, NULL };
strbuf_getline_fn getline_fn;
int num_ignored = 0;
getline_fn = nul_term_line ? strbuf_getline_nul : strbuf_getline_lf;
while (getline_fn(&buf, stdin) != EOF) {
Reported by FlawFinder.