Error: SHELLCHECK_WARNING (CWE-456): [#def1] /usr/libexec/git-core/git-gui:12:5: warning[SC2121]: To assign a variable, use just 'var=value', no 'set ..'. # 10| exec 'wish' "$argv0" -- "$@" # 11| # 12|-> set appvers {0.21.0.257.g1a729} # 13| set copyright [string map [list (c) \u00a9] { # 14| Copyright (c) 2006-2010 Shawn Pearce, et. al. Error: SHELLCHECK_WARNING (CWE-569): [#def2] /usr/libexec/git-core/git-gui:12:13: warning[SC1083]: This { is literal. Check expression (missing ;/\n?) or quote it. # 10| exec 'wish' "$argv0" -- "$@" # 11| # 12|-> set appvers {0.21.0.257.g1a729} # 13| set copyright [string map [list (c) \u00a9] { # 14| Copyright (c) 2006-2010 Shawn Pearce, et. al. Error: SHELLCHECK_WARNING (CWE-569): [#def3] /usr/libexec/git-core/git-gui:12:31: warning[SC1083]: This } is literal. Check expression (missing ;/\n?) or quote it. # 10| exec 'wish' "$argv0" -- "$@" # 11| # 12|-> set appvers {0.21.0.257.g1a729} # 13| set copyright [string map [list (c) \u00a9] { # 14| Copyright (c) 2006-2010 Shawn Pearce, et. al. Error: SHELLCHECK_WARNING (CWE-569): [#def4] /usr/share/doc/git/contrib/coverage-diff.sh:48:1: warning[SC2188]: This redirection doesn't have a command. Move to its command (or use 'true' as no-op). # 46| # 47| # create empty file # 48|-> >coverage-data.txt # 49| # 50| for file in $files Error: SHELLCHECK_WARNING (CWE-252): [#def5] /usr/share/doc/git/contrib/update-unicode/update_unicode.sh:8:1: warning[SC2164]: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. # 6| #Cf Format a format control character # 7| # # 8|-> cd "$(dirname "$0")" # 9| UNICODEWIDTH_H=$(git rev-parse --show-toplevel)/unicode-width.h # 10| Error: COMPILER_WARNING (CWE-704): [#def6] git-2.53.0/add-patch.c: scope_hint: In function ‘parse_hunk_header’ git-2.53.0/add-patch.c:345:21: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 345 | char *eol = memchr(p, '\n', s->plain.len - hunk->start); # | ^~~~~~ # 343| struct hunk_header *header = &hunk->header; # 344| const char *line = s->plain.buf + hunk->start, *p = line; # 345|-> char *eol = memchr(p, '\n', s->plain.len - hunk->start); # 346| # 347| if (!eol) Error: COMPILER_WARNING (CWE-704): [#def7] git-2.53.0/add-patch.c:345:21: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 343| struct hunk_header *header = &hunk->header; # 344| const char *line = s->plain.buf + hunk->start, *p = line; # 345|-> char *eol = memchr(p, '\n', s->plain.len - hunk->start); # 346| # 347| if (!eol) Error: COMPILER_WARNING (CWE-704): [#def8] git-2.53.0/add-patch.c:369:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 369 | eol = memchr(line, '\n', s->colored.len - hunk->colored_start); # | ^ # 367| /* Now find the extra text in the colored diff */ # 368| line = s->colored.buf + hunk->colored_start; # 369|-> eol = memchr(line, '\n', s->colored.len - hunk->colored_start); # 370| if (!eol) # 371| eol = s->colored.buf + s->colored.len; Error: COMPILER_WARNING (CWE-704): [#def9] git-2.53.0/add-patch.c:369:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 367| /* Now find the extra text in the colored diff */ # 368| line = s->colored.buf + hunk->colored_start; # 369|-> eol = memchr(line, '\n', s->colored.len - hunk->colored_start); # 370| if (!eol) # 371| eol = s->colored.buf + s->colored.len; Error: COMPILER_WARNING (CWE-704): [#def10] git-2.53.0/apply.c: scope_hint: In function ‘preimage_oid_in_gitlink_patch’ git-2.53.0/apply.c:4154:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 4154 | (preimage = memchr(hunk->patch, '\n', hunk->size)) != NULL && # | ^ # 4152| hunk->oldpos == 1 && hunk->oldlines == 1 && # 4153| /* does preimage begin with the heading? */ # 4154|-> (preimage = memchr(hunk->patch, '\n', hunk->size)) != NULL && # 4155| starts_with(++preimage, heading) && # 4156| /* does it record full SHA-1? */ Error: COMPILER_WARNING (CWE-704): [#def11] git-2.53.0/apply.c:4154:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 4152| hunk->oldpos == 1 && hunk->oldlines == 1 && # 4153| /* does preimage begin with the heading? */ # 4154|-> (preimage = memchr(hunk->patch, '\n', hunk->size)) != NULL && # 4155| starts_with(++preimage, heading) && # 4156| /* does it record full SHA-1? */ Error: COMPILER_WARNING (CWE-704): [#def12] git-2.53.0/bloom.c: scope_hint: In function ‘get_or_compute_bloom_filter’ git-2.53.0/bloom.c:515:52: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 515 | char *last_slash = strrchr(path, '/'); # | ^~~~~~~ # 513| */ # 514| do { # 515|-> char *last_slash = strrchr(path, '/'); # 516| # 517| FLEX_ALLOC_STR(e, path, path); Error: COMPILER_WARNING (CWE-704): [#def13] git-2.53.0/bloom.c:515:52: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 513| */ # 514| do { # 515|-> char *last_slash = strrchr(path, '/'); # 516| # 517| FLEX_ALLOC_STR(e, path, path); Error: COMPILER_WARNING (CWE-704): [#def14] git-2.53.0/builtin/commit.c: scope_hint: In function ‘prepare_to_commit’ git-2.53.0/builtin/commit.c:820:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 820 | buffer = strstr(use_message_buffer, "\n\n"); # | ^ # 818| } else if (use_message) { # 819| char *buffer; # 820|-> buffer = strstr(use_message_buffer, "\n\n"); # 821| if (buffer) # 822| strbuf_addstr(&sb, skip_blank_lines(buffer + 2)); Error: COMPILER_WARNING (CWE-704): [#def15] git-2.53.0/builtin/commit.c:820:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 818| } else if (use_message) { # 819| char *buffer; # 820|-> buffer = strstr(use_message_buffer, "\n\n"); # 821| if (buffer) # 822| strbuf_addstr(&sb, skip_blank_lines(buffer + 2)); Error: COMPILER_WARNING (CWE-704): [#def16] git-2.53.0/builtin/config.c: scope_hint: In function ‘get_urlmatch’ git-2.53.0/builtin/config.c:723:22: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 723 | section_tail = strchr(config.section, '.'); # | ^ # 721| # 722| config.section = xstrdup_tolower(var); # 723|-> section_tail = strchr(config.section, '.'); # 724| if (section_tail) { # 725| *section_tail = '\0'; Error: COMPILER_WARNING (CWE-704): [#def17] git-2.53.0/builtin/config.c:723:22: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 721| # 722| config.section = xstrdup_tolower(var); # 723|-> section_tail = strchr(config.section, '.'); # 724| if (section_tail) { # 725| *section_tail = '\0'; Error: GCC_ANALYZER_WARNING (CWE-688): [#def18] git-2.53.0/builtin/interpret-trailers.c:105:13: warning[-Wanalyzer-null-argument]: use of NULL ‘file’ where non-null expected git-2.53.0/builtin/interpret-trailers.c:194:5: enter_function: entry to ‘cmd_interpret_trailers’ git-2.53.0/builtin/interpret-trailers.c:235:12: branch_false: following ‘false’ branch... git-2.53.0/builtin/interpret-trailers.c:240:21: branch_false: ...to here git-2.53.0/builtin/interpret-trailers.c:240:20: branch_false: following ‘false’ branch... git-2.53.0/builtin/interpret-trailers.c:242:17: branch_false: ...to here git-2.53.0/builtin/interpret-trailers.c:242:17: call_function: calling ‘interpret_trailers’ from ‘cmd_interpret_trailers’ # 103| FILE *outfile; # 104| # 105|-> if (stat(file, &st)) # 106| die_errno(_("could not stat %s"), file); # 107| if (!S_ISREG(st.st_mode)) Error: COMPILER_WARNING (CWE-704): [#def19] git-2.53.0/builtin/receive-pack.c: scope_hint: In function ‘proc_receive_ref_append’ git-2.53.0/builtin/receive-pack.c:400:11: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 400 | p = strchr(prefix, ':'); # | ^ # 398| # 399| CALLOC_ARRAY(ref_pattern, 1); # 400|-> p = strchr(prefix, ':'); # 401| if (p) { # 402| while (prefix < p) { Error: COMPILER_WARNING (CWE-704): [#def20] git-2.53.0/builtin/receive-pack.c:400:11: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 398| # 399| CALLOC_ARRAY(ref_pattern, 1); # 400|-> p = strchr(prefix, ':'); # 401| if (p) { # 402| while (prefix < p) { Error: COMPILER_WARNING (CWE-704): [#def21] git-2.53.0/builtin/receive-pack.c: scope_hint: In function ‘read_proc_receive_report’ git-2.53.0/builtin/receive-pack.c:1009:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1009 | p = strchr(head, ' '); # | ^ # 1007| # 1008| head = reader->line; # 1009|-> p = strchr(head, ' '); # 1010| if (!p) { # 1011| strbuf_addf(errmsg, "proc-receive reported incomplete status line: '%s'\n", head); Error: COMPILER_WARNING (CWE-704): [#def22] git-2.53.0/builtin/receive-pack.c:1009:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1007| # 1008| head = reader->line; # 1009|-> p = strchr(head, ' '); # 1010| if (!p) { # 1011| strbuf_addf(errmsg, "proc-receive reported incomplete status line: '%s'\n", head); Error: COMPILER_WARNING (CWE-704): [#def23] git-2.53.0/builtin/receive-pack.c:1039:27: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1039 | p = strchr(key, ' '); # | ^ # 1037| } # 1038| key = p; # 1039|-> p = strchr(key, ' '); # 1040| if (p) # 1041| *p++ = '\0'; Error: COMPILER_WARNING (CWE-704): [#def24] git-2.53.0/builtin/receive-pack.c:1039:27: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1037| } # 1038| key = p; # 1039|-> p = strchr(key, ' '); # 1040| if (p) # 1041| *p++ = '\0'; Error: COMPILER_WARNING (CWE-704): [#def25] git-2.53.0/builtin/receive-pack.c:1062:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1062 | p = strchr(refname, ' '); # | ^ # 1060| new_report = 0; # 1061| refname = p; # 1062|-> p = strchr(refname, ' '); # 1063| if (p) # 1064| *p++ = '\0'; Error: COMPILER_WARNING (CWE-704): [#def26] git-2.53.0/builtin/receive-pack.c:1062:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1060| new_report = 0; # 1061| refname = p; # 1062|-> p = strchr(refname, ' '); # 1063| if (p) # 1064| *p++ = '\0'; Error: COMPILER_WARNING (CWE-704): [#def27] git-2.53.0/builtin/remote.c: scope_hint: In function ‘config_read_branches’ git-2.53.0/builtin/remote.c:335:31: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 335 | char *space = strchr(value, ' '); # | ^~~~~~ # 333| break; # 334| case MERGE: { # 335|-> char *space = strchr(value, ' '); # 336| value = abbrev_branch(value); # 337| while (space) { Error: COMPILER_WARNING (CWE-704): [#def28] git-2.53.0/builtin/remote.c:335:31: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 333| break; # 334| case MERGE: { # 335|-> char *space = strchr(value, ' '); # 336| value = abbrev_branch(value); # 337| while (space) { Error: COMPILER_WARNING (CWE-704): [#def29] git-2.53.0/builtin/remote.c:342:31: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 342 | space = strchr(value, ' '); # | ^ # 340| string_list_append(&info->merge, merge); # 341| value = abbrev_branch(space + 1); # 342|-> space = strchr(value, ' '); # 343| } # 344| string_list_append(&info->merge, xstrdup(value)); Error: COMPILER_WARNING (CWE-704): [#def30] git-2.53.0/builtin/remote.c:342:31: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 340| string_list_append(&info->merge, merge); # 341| value = abbrev_branch(space + 1); # 342|-> space = strchr(value, ' '); # 343| } # 344| string_list_append(&info->merge, xstrdup(value)); Error: COMPILER_WARNING (CWE-704): [#def31] git-2.53.0/builtin/rev-parse.c: scope_hint: In function ‘try_difference’ git-2.53.0/builtin/rev-parse.c:278:22: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 278 | if (!(dotdot = strstr(arg, ".."))) # | ^ # 276| static const char head_by_default[] = "HEAD"; # 277| # 278|-> if (!(dotdot = strstr(arg, ".."))) # 279| return 0; # 280| end = dotdot + 2; Error: COMPILER_WARNING (CWE-704): [#def32] git-2.53.0/builtin/rev-parse.c:278:22: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 276| static const char head_by_default[] = "HEAD"; # 277| # 278|-> if (!(dotdot = strstr(arg, ".."))) # 279| return 0; # 280| end = dotdot + 2; Error: COMPILER_WARNING (CWE-704): [#def33] git-2.53.0/builtin/rev-parse.c: scope_hint: In function ‘try_parent_shorthands’ git-2.53.0/builtin/rev-parse.c:339:21: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 339 | if ((dotdot = strstr(arg, "^!"))) { # | ^ # 337| int exclude_parent = 0; # 338| # 339|-> if ((dotdot = strstr(arg, "^!"))) { # 340| include_rev = 1; # 341| if (dotdot[2]) Error: COMPILER_WARNING (CWE-704): [#def34] git-2.53.0/builtin/rev-parse.c:339:21: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 337| int exclude_parent = 0; # 338| # 339|-> if ((dotdot = strstr(arg, "^!"))) { # 340| include_rev = 1; # 341| if (dotdot[2]) Error: COMPILER_WARNING (CWE-704): [#def35] git-2.53.0/builtin/rev-parse.c:343:28: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 343 | } else if ((dotdot = strstr(arg, "^@"))) { # | ^ # 341| if (dotdot[2]) # 342| return 0; # 343|-> } else if ((dotdot = strstr(arg, "^@"))) { # 344| include_parents = 1; # 345| if (dotdot[2]) Error: COMPILER_WARNING (CWE-704): [#def36] git-2.53.0/builtin/rev-parse.c:343:28: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 341| if (dotdot[2]) # 342| return 0; # 343|-> } else if ((dotdot = strstr(arg, "^@"))) { # 344| include_parents = 1; # 345| if (dotdot[2]) Error: COMPILER_WARNING (CWE-704): [#def37] git-2.53.0/builtin/rev-parse.c:347:28: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 347 | } else if ((dotdot = strstr(arg, "^-"))) { # | ^ # 345| if (dotdot[2]) # 346| return 0; # 347|-> } else if ((dotdot = strstr(arg, "^-"))) { # 348| include_rev = 1; # 349| exclude_parent = 1; Error: COMPILER_WARNING (CWE-704): [#def38] git-2.53.0/builtin/rev-parse.c:347:28: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 345| if (dotdot[2]) # 346| return 0; # 347|-> } else if ((dotdot = strstr(arg, "^-"))) { # 348| include_rev = 1; # 349| exclude_parent = 1; Error: COMPILER_WARNING (CWE-704): [#def39] git-2.53.0/builtin/shortlog.c: scope_hint: In function ‘insert_one_record’ git-2.53.0/builtin/shortlog.c:79:37: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 79 | char *eob = strchr(oneline, ']'); # | ^~~~~~ # 77| eol = oneline + strlen(oneline); # 78| if (starts_with(oneline, "[PATCH")) { # 79|-> char *eob = strchr(oneline, ']'); # 80| if (eob && (!eol || eob < eol)) # 81| oneline = eob + 1; Error: COMPILER_WARNING (CWE-704): [#def40] git-2.53.0/builtin/shortlog.c:79:37: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 77| eol = oneline + strlen(oneline); # 78| if (starts_with(oneline, "[PATCH")) { # 79|-> char *eob = strchr(oneline, ']'); # 80| if (eob && (!eol || eob < eol)) # 81| oneline = eob + 1; Error: GCC_ANALYZER_WARNING (CWE-617): [#def41] git-2.53.0/builtin/show-index.c:59:25: warning[-Wanalyzer-tainted-assertion]: use of attacked-controlled value in condition for assertion git-2.53.0/builtin/show-index.c:54:12: branch_false: following ‘false’ branch... git-2.53.0/builtin/show-index.c:56:13: branch_false: ...to here git-2.53.0/builtin/show-index.c:56:12: branch_true: following ‘true’ branch... git-2.53.0/builtin/show-index.c:57:27: branch_true: ...to here git-2.53.0/builtin/show-index.c:58:20: branch_true: following ‘true’ branch... git-2.53.0/builtin/show-index.c:59:25: branch_true: ...to here git-2.53.0/builtin/show-index.c:59:25: danger: treating ‘die’ as an assertion failure handler due to ‘__attribute__((__noreturn__))’ # 57| version = ntohl(top_index[1]); # 58| if (version < 2 || version > 2) # 59|-> die("unknown index version"); # 60| if (fread(top_index, 256 * 4, 1, stdin) != 1) # 61| die("unable to read index"); Error: COMPILER_WARNING (CWE-704): [#def42] git-2.53.0/convert.c: scope_hint: In function ‘ident_to_git’ git-2.53.0/convert.c:1138:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1138 | dollar = memchr(src, '$', len); # | ^ # 1136| dst = buf->buf; # 1137| for (;;) { # 1138|-> dollar = memchr(src, '$', len); # 1139| if (!dollar) # 1140| break; Error: COMPILER_WARNING (CWE-704): [#def43] git-2.53.0/convert.c:1138:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1136| dst = buf->buf; # 1137| for (;;) { # 1138|-> dollar = memchr(src, '$', len); # 1139| if (!dollar) # 1140| break; Error: COMPILER_WARNING (CWE-704): [#def44] git-2.53.0/convert.c:1147:32: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1147 | dollar = memchr(src + 3, '$', len - 3); # | ^ # 1145| # 1146| if (len > 3 && !memcmp(src, "Id:", 3)) { # 1147|-> dollar = memchr(src + 3, '$', len - 3); # 1148| if (!dollar) # 1149| break; Error: COMPILER_WARNING (CWE-704): [#def45] git-2.53.0/convert.c:1147:32: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1145| # 1146| if (len > 3 && !memcmp(src, "Id:", 3)) { # 1147|-> dollar = memchr(src + 3, '$', len - 3); # 1148| if (!dollar) # 1149| break; Error: COMPILER_WARNING (CWE-704): [#def46] git-2.53.0/convert.c: scope_hint: In function ‘ident_to_worktree’ git-2.53.0/convert.c:1188:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1188 | dollar = memchr(src, '$', len); # | ^ # 1186| for (;;) { # 1187| /* step 1: run to the next '$' */ # 1188|-> dollar = memchr(src, '$', len); # 1189| if (!dollar) # 1190| break; Error: COMPILER_WARNING (CWE-704): [#def47] git-2.53.0/convert.c:1188:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1186| for (;;) { # 1187| /* step 1: run to the next '$' */ # 1188|-> dollar = memchr(src, '$', len); # 1189| if (!dollar) # 1190| break; Error: COMPILER_WARNING (CWE-704): [#def48] git-2.53.0/convert.c:1211:32: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1211 | dollar = memchr(src + 3, '$', len - 3); # | ^ # 1209| * for git-style ids. # 1210| */ # 1211|-> dollar = memchr(src + 3, '$', len - 3); # 1212| if (!dollar) { # 1213| /* incomplete keyword, no more '$', so just quit the loop */ Error: COMPILER_WARNING (CWE-704): [#def49] git-2.53.0/convert.c:1211:32: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1209| * for git-style ids. # 1210| */ # 1211|-> dollar = memchr(src + 3, '$', len - 3); # 1212| if (!dollar) { # 1213| /* incomplete keyword, no more '$', so just quit the loop */ Error: COMPILER_WARNING (CWE-704): [#def50] git-2.53.0/convert.c:1222:29: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1222 | spc = memchr(src + 4, ' ', dollar - src - 4); # | ^ # 1220| } # 1221| # 1222|-> spc = memchr(src + 4, ' ', dollar - src - 4); # 1223| if (spc && spc < dollar-1) { # 1224| /* There are spaces in unexpected places. Error: COMPILER_WARNING (CWE-704): [#def51] git-2.53.0/convert.c:1222:29: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1220| } # 1221| # 1222|-> spc = memchr(src + 4, ' ', dollar - src - 4); # 1223| if (spc && spc < dollar-1) { # 1224| /* There are spaces in unexpected places. Error: COMPILER_WARNING (CWE-704): [#def52] git-2.53.0/diff.c: scope_hint: In function ‘fn_out_diff_words_write_helper’ git-2.53.0/diff.c:1964:27: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 1964 | char *p = memchr(buf, '\n', count); # | ^~~~~~ # 1962| # 1963| while (count) { # 1964|-> char *p = memchr(buf, '\n', count); # 1965| if (print) # 1966| strbuf_addstr(&sb, diff_line_prefix(o)); Error: COMPILER_WARNING (CWE-704): [#def53] git-2.53.0/diff.c:1964:27: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 1962| # 1963| while (count) { # 1964|-> char *p = memchr(buf, '\n', count); # 1965| if (print) # 1966| strbuf_addstr(&sb, diff_line_prefix(o)); Error: COMPILER_WARNING (CWE-704): [#def54] git-2.53.0/diff.c: scope_hint: In function ‘gather_dirstat’ git-2.53.0/diff.c:3058:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 3058 | slash = strchr(f->name + baselen, '/'); # | ^ # 3056| if (memcmp(f->name, base, baselen)) # 3057| break; # 3058|-> slash = strchr(f->name + baselen, '/'); # 3059| if (slash) { # 3060| int newbaselen = slash + 1 - f->name; Error: COMPILER_WARNING (CWE-704): [#def55] git-2.53.0/diff.c:3058:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 3056| if (memcmp(f->name, base, baselen)) # 3057| break; # 3058|-> slash = strchr(f->name + baselen, '/'); # 3059| if (slash) { # 3060| int newbaselen = slash + 1 - f->name; Error: COMPILER_WARNING (CWE-704): [#def56] git-2.53.0/diffcore-rename.c: scope_hint: In function ‘get_dirname’ git-2.53.0/diffcore-rename.c:382:23: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 382 | char *slash = strrchr(filename, '/'); # | ^~~~~~~ # 380| static char *get_dirname(const char *filename) # 381| { # 382|-> char *slash = strrchr(filename, '/'); # 383| return slash ? xstrndup(filename, slash - filename) : xstrdup(""); # 384| } Error: COMPILER_WARNING (CWE-704): [#def57] git-2.53.0/diffcore-rename.c:382:23: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 380| static char *get_dirname(const char *filename) # 381| { # 382|-> char *slash = strrchr(filename, '/'); # 383| return slash ? xstrndup(filename, slash - filename) : xstrdup(""); # 384| } Error: COMPILER_WARNING (CWE-704): [#def58] git-2.53.0/dir.c: scope_hint: In function ‘remove_path’ git-2.53.0/dir.c:3524:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 3524 | slash = strrchr(name, '/'); # | ^ # 3522| return -1; # 3523| # 3524|-> slash = strrchr(name, '/'); # 3525| if (slash) { # 3526| char *dirs = xstrdup(name); Error: COMPILER_WARNING (CWE-704): [#def59] git-2.53.0/dir.c:3524:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 3522| return -1; # 3523| # 3524|-> slash = strrchr(name, '/'); # 3525| if (slash) { # 3526| char *dirs = xstrdup(name); Error: COMPILER_WARNING (CWE-704): [#def60] git-2.53.0/fmt-merge-msg.c: scope_hint: In function ‘record_person_from_buf’ git-2.53.0/fmt-merge-msg.c:254:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 254 | name = strstr(buffer, field); # | ^ # 252| # 253| field = (which == 'a') ? "\nauthor " : "\ncommitter "; # 254|-> name = strstr(buffer, field); # 255| if (!name) # 256| return; Error: COMPILER_WARNING (CWE-704): [#def61] git-2.53.0/fmt-merge-msg.c:254:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 252| # 253| field = (which == 'a') ? "\nauthor " : "\ncommitter "; # 254|-> name = strstr(buffer, field); # 255| if (!name) # 256| return; Error: COMPILER_WARNING (CWE-704): [#def62] git-2.53.0/fsck.c: scope_hint: In function ‘fsck_tag_standalone’ git-2.53.0/fsck.c:1058:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1058 | eol = memchr(buffer, '\n', buffer_end - buffer); # | ^ # 1056| goto done; # 1057| } # 1058|-> eol = memchr(buffer, '\n', buffer_end - buffer); # 1059| if (!eol) { # 1060| ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TYPE, "invalid format - unexpected end after 'type' line"); Error: COMPILER_WARNING (CWE-704): [#def63] git-2.53.0/fsck.c:1058:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1056| goto done; # 1057| } # 1058|-> eol = memchr(buffer, '\n', buffer_end - buffer); # 1059| if (!eol) { # 1060| ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TYPE, "invalid format - unexpected end after 'type' line"); Error: COMPILER_WARNING (CWE-704): [#def64] git-2.53.0/fsck.c:1074:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1074 | eol = memchr(buffer, '\n', buffer_end - buffer); # | ^ # 1072| goto done; # 1073| } # 1074|-> eol = memchr(buffer, '\n', buffer_end - buffer); # 1075| if (!eol) { # 1076| ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TAG, "invalid format - unexpected end after 'type' line"); Error: COMPILER_WARNING (CWE-704): [#def65] git-2.53.0/fsck.c:1074:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1072| goto done; # 1073| } # 1074|-> eol = memchr(buffer, '\n', buffer_end - buffer); # 1075| if (!eol) { # 1076| ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TAG, "invalid format - unexpected end after 'type' line"); Error: COMPILER_WARNING (CWE-704): [#def66] git-2.53.0/fsck.c:1100:21: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1100 | eol = memchr(buffer, '\n', buffer_end - buffer); # | ^ # 1098| # 1099| if (buffer < buffer_end && (skip_prefix(buffer, "gpgsig ", &buffer) || skip_prefix(buffer, "gpgsig-sha256 ", &buffer))) { # 1100|-> eol = memchr(buffer, '\n', buffer_end - buffer); # 1101| if (!eol) { # 1102| ret = report(options, oid, OBJ_TAG, FSCK_MSG_BAD_GPGSIG, "invalid format - unexpected end after 'gpgsig' or 'gpgsig-sha256' line"); Error: COMPILER_WARNING (CWE-704): [#def67] git-2.53.0/fsck.c:1100:21: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1098| # 1099| if (buffer < buffer_end && (skip_prefix(buffer, "gpgsig ", &buffer) || skip_prefix(buffer, "gpgsig-sha256 ", &buffer))) { # 1100|-> eol = memchr(buffer, '\n', buffer_end - buffer); # 1101| if (!eol) { # 1102| ret = report(options, oid, OBJ_TAG, FSCK_MSG_BAD_GPGSIG, "invalid format - unexpected end after 'gpgsig' or 'gpgsig-sha256' line"); Error: COMPILER_WARNING (CWE-704): [#def68] git-2.53.0/fsck.c:1108:29: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1108 | eol = memchr(buffer, '\n', buffer_end - buffer); # | ^ # 1106| # 1107| while (buffer < buffer_end && starts_with(buffer, " ")) { # 1108|-> eol = memchr(buffer, '\n', buffer_end - buffer); # 1109| if (!eol) { # 1110| ret = report(options, oid, OBJ_TAG, FSCK_MSG_BAD_HEADER_CONTINUATION, "invalid format - unexpected end in 'gpgsig' or 'gpgsig-sha256' continuation line"); Error: COMPILER_WARNING (CWE-704): [#def69] git-2.53.0/fsck.c:1108:29: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1106| # 1107| while (buffer < buffer_end && starts_with(buffer, " ")) { # 1108|-> eol = memchr(buffer, '\n', buffer_end - buffer); # 1109| if (!eol) { # 1110| ret = report(options, oid, OBJ_TAG, FSCK_MSG_BAD_HEADER_CONTINUATION, "invalid format - unexpected end in 'gpgsig' or 'gpgsig-sha256' continuation line"); Error: COMPILER_WARNING (CWE-704): [#def70] git-2.53.0/kwset.c:37: included_from: Included from here. git-2.53.0/git-compat-util.h: scope_hint: In function ‘git_find_last_dir_sep’ git-2.53.0/git-compat-util.h:344:16: warning[-Wdiscarded-qualifiers]: return discards ‘const’ qualifier from pointer target type # 344 | return strrchr(path, '/'); # | ^~~~~~~ # 342| static inline char *git_find_last_dir_sep(const char *path) # 343| { # 344|-> return strrchr(path, '/'); # 345| } # 346| #define find_last_dir_sep git_find_last_dir_sep Error: COMPILER_WARNING (CWE-704): [#def71] git-2.53.0/git-compat-util.h:344:16: warning[-Wdiscarded-qualifiers]: return discards ‘const’ qualifier from pointer target type # 342| static inline char *git_find_last_dir_sep(const char *path) # 343| { # 344|-> return strrchr(path, '/'); # 345| } # 346| #define find_last_dir_sep git_find_last_dir_sep Error: COMPILER_WARNING (CWE-704): [#def72] git-2.53.0/gpg-interface.c: scope_hint: In function ‘parse_ssh_output’ git-2.53.0/gpg-interface.c:444:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 444 | key = strstr(line, "key "); # | ^ # 442| } # 443| # 444|-> key = strstr(line, "key "); # 445| if (key) { # 446| sigc->fingerprint = xstrdup(key + 4); Error: COMPILER_WARNING (CWE-704): [#def73] git-2.53.0/gpg-interface.c:444:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 442| } # 443| # 444|-> key = strstr(line, "key "); # 445| if (key) { # 446| sigc->fingerprint = xstrdup(key + 4); Error: COMPILER_WARNING (CWE-704): [#def74] git-2.53.0/help.c: scope_hint: In function ‘append_similar_ref’ git-2.53.0/help.c:860:24: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 860 | char *branch = strrchr(ref->name, '/') + 1; # | ^~~~~~~ # 858| { # 859| struct similar_ref_cb *cb = (struct similar_ref_cb *)(cb_data); # 860|-> char *branch = strrchr(ref->name, '/') + 1; # 861| # 862| /* A remote branch of the same name is deemed similar */ Error: COMPILER_WARNING (CWE-704): [#def75] git-2.53.0/help.c:860:24: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 858| { # 859| struct similar_ref_cb *cb = (struct similar_ref_cb *)(cb_data); # 860|-> char *branch = strrchr(ref->name, '/') + 1; # 861| # 862| /* A remote branch of the same name is deemed similar */ Error: COMPILER_WARNING (CWE-704): [#def76] git-2.53.0/http-push.c: scope_hint: In function ‘cmd_main’ git-2.53.0/http-push.c:1771:38: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 1771 | char *path = strstr(arg, "//"); # | ^~~~~~ # 1769| } # 1770| if (!repo->url) { # 1771|-> char *path = strstr(arg, "//"); # 1772| str_end_url_with_slash(arg, &repo->url); # 1773| repo->path_len = strlen(repo->url); Error: COMPILER_WARNING (CWE-704): [#def77] git-2.53.0/http-push.c:1771:38: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 1769| } # 1770| if (!repo->url) { # 1771|-> char *path = strstr(arg, "//"); # 1772| str_end_url_with_slash(arg, &repo->url); # 1773| repo->path_len = strlen(repo->url); Error: COMPILER_WARNING (CWE-704): [#def78] git-2.53.0/http.c: scope_hint: In function ‘redact_sensitive_header’ git-2.53.0/http.c:755:43: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 755 | char *semicolon = strstr(cookie, "; "); # | ^~~~~~ # 753| while (cookie) { # 754| char *equals; # 755|-> char *semicolon = strstr(cookie, "; "); # 756| if (semicolon) # 757| *semicolon = 0; Error: COMPILER_WARNING (CWE-704): [#def79] git-2.53.0/http.c:755:43: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 753| while (cookie) { # 754| char *equals; # 755|-> char *semicolon = strstr(cookie, "; "); # 756| if (semicolon) # 757| *semicolon = 0; Error: COMPILER_WARNING (CWE-704): [#def80] git-2.53.0/mailinfo.c: scope_hint: In function ‘output_header_lines’ git-2.53.0/mailinfo.c:1144:28: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 1144 | char *ep = strchr(sp, '\n'); # | ^~~~~~ # 1142| const char *sp = data->buf; # 1143| while (1) { # 1144|-> char *ep = strchr(sp, '\n'); # 1145| int len; # 1146| if (!ep) Error: COMPILER_WARNING (CWE-704): [#def81] git-2.53.0/mailinfo.c:1144:28: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 1142| const char *sp = data->buf; # 1143| while (1) { # 1144|-> char *ep = strchr(sp, '\n'); # 1145| int len; # 1146| if (!ep) Error: COMPILER_WARNING (CWE-704): [#def82] git-2.53.0/mem-pool.c: scope_hint: In function ‘mem_pool_strndup’ git-2.53.0/mem-pool.c:172:19: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 172 | char *p = memchr(str, '\0', len); # | ^~~~~~ # 170| char *mem_pool_strndup(struct mem_pool *pool, const char *str, size_t len) # 171| { # 172|-> char *p = memchr(str, '\0', len); # 173| size_t actual_len = (p ? p - str : len); # 174| char *ret = mem_pool_alloc(pool, actual_len+1); Error: COMPILER_WARNING (CWE-704): [#def83] git-2.53.0/mem-pool.c:172:19: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 170| char *mem_pool_strndup(struct mem_pool *pool, const char *str, size_t len) # 171| { # 172|-> char *p = memchr(str, '\0', len); # 173| size_t actual_len = (p ? p - str : len); # 174| char *ret = mem_pool_alloc(pool, actual_len+1); Error: COMPILER_WARNING (CWE-704): [#def84] git-2.53.0/object-name.c: scope_hint: In function ‘repo_interpret_branch_name’ git-2.53.0/object-name.c:1780:18: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1780 | (at = memchr(start, '@', namelen - (start - name))); # | ^ # 1778| # 1779| for (start = name; # 1780|-> (at = memchr(start, '@', namelen - (start - name))); # 1781| start = at + 1) { # 1782| Error: COMPILER_WARNING (CWE-704): [#def85] git-2.53.0/object-name.c:1780:18: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1778| # 1779| for (start = name; # 1780|-> (at = memchr(start, '@', namelen - (start - name))); # 1781| start = at + 1) { # 1782| Error: COMPILER_WARNING (CWE-704): [#def86] git-2.53.0/pack-revindex.c: scope_hint: In function ‘midx_key_to_pack_pos’ git-2.53.0/pack-revindex.c:564:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 564 | found = bsearch(key, m->revindex_data, m->num_objects, # | ^ # 562| return error(_("could not determine preferred pack")); # 563| # 564|-> found = bsearch(key, m->revindex_data, m->num_objects, # 565| sizeof(*m->revindex_data), # 566| midx_pack_order_cmp); Error: COMPILER_WARNING (CWE-704): [#def87] git-2.53.0/pack-revindex.c:564:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 562| return error(_("could not determine preferred pack")); # 563| # 564|-> found = bsearch(key, m->revindex_data, m->num_objects, # 565| sizeof(*m->revindex_data), # 566| midx_pack_order_cmp); Error: COMPILER_WARNING (CWE-704): [#def88] git-2.53.0/pager.c: scope_hint: In function ‘setup_pager_env’ git-2.53.0/pager.c:121:28: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 121 | char *cp = strchr(argv[i], '='); # | ^~~~~~ # 119| # 120| for (i = 0; i < n; i++) { # 121|-> char *cp = strchr(argv[i], '='); # 122| # 123| if (!cp) Error: COMPILER_WARNING (CWE-704): [#def89] git-2.53.0/pager.c:121:28: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 119| # 120| for (i = 0; i < n; i++) { # 121|-> char *cp = strchr(argv[i], '='); # 122| # 123| if (!cp) Error: COMPILER_WARNING (CWE-704): [#def90] git-2.53.0/pkt-line.c: scope_hint: In function ‘find_packfile_uri_path’ git-2.53.0/pkt-line.c:401:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 401 | path = strstr(buffer + len + 1, URI_MARK); # | ^ # 399| return NULL; /* required "<hash>SP" not seen */ # 400| # 401|-> path = strstr(buffer + len + 1, URI_MARK); # 402| if (!path) # 403| return NULL; Error: COMPILER_WARNING (CWE-704): [#def91] git-2.53.0/pkt-line.c:401:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 399| return NULL; /* required "<hash>SP" not seen */ # 400| # 401|-> path = strstr(buffer + len + 1, URI_MARK); # 402| if (!path) # 403| return NULL; Error: COMPILER_WARNING (CWE-704): [#def92] git-2.53.0/pseudo-merge.c: scope_hint: In function ‘find_pseudo_merge’ git-2.53.0/pseudo-merge.c:647:16: warning[-Wdiscarded-qualifiers]: return discards ‘const’ qualifier from pointer target type # 647 | return bsearch(&pos, pm->commits, pm->commits_nr, # | ^~~~~~~ # 645| return NULL; # 646| # 647|-> return bsearch(&pos, pm->commits, pm->commits_nr, # 648| PSEUDO_MERGE_COMMIT_RAWSZ, pseudo_merge_commit_cmp); # 649| } Error: COMPILER_WARNING (CWE-704): [#def93] git-2.53.0/pseudo-merge.c:647:16: warning[-Wdiscarded-qualifiers]: return discards ‘const’ qualifier from pointer target type # 645| return NULL; # 646| # 647|-> return bsearch(&pos, pm->commits, pm->commits_nr, # 648| PSEUDO_MERGE_COMMIT_RAWSZ, pseudo_merge_commit_cmp); # 649| } Error: COMPILER_WARNING (CWE-704): [#def94] git-2.53.0/range-diff.c: scope_hint: In function ‘read_patches’ git-2.53.0/range-diff.c:109:50: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 109 | if (include_merges && (q = strstr(p, " (from "))) # | ^ # 107| } # 108| CALLOC_ARRAY(util, 1); # 109|-> if (include_merges && (q = strstr(p, " (from "))) # 110| *q = '\0'; # 111| if (repo_get_oid(the_repository, p, &util->oid)) { Error: COMPILER_WARNING (CWE-704): [#def95] git-2.53.0/range-diff.c:109:50: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 107| } # 108| CALLOC_ARRAY(util, 1); # 109|-> if (include_merges && (q = strstr(p, " (from "))) # 110| *q = '\0'; # 111| if (repo_get_oid(the_repository, p, &util->oid)) { Error: COMPILER_WARNING (CWE-704): [#def96] git-2.53.0/ref-filter.c: scope_hint: In function ‘rstrip_ref_components’ git-2.53.0/ref-filter.c:2237:27: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 2237 | char *p = strrchr(start, '/'); # | ^~~~~~~ # 2235| # 2236| while (remaining-- > 0) { # 2237|-> char *p = strrchr(start, '/'); # 2238| if (!p) { # 2239| free((char *)to_free); Error: COMPILER_WARNING (CWE-704): [#def97] git-2.53.0/ref-filter.c:2237:27: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 2235| # 2236| while (remaining-- > 0) { # 2237|-> char *p = strrchr(start, '/'); # 2238| if (!p) { # 2239| free((char *)to_free); Error: COMPILER_WARNING (CWE-704): [#def98] git-2.53.0/reflog-walk.c: scope_hint: In function ‘add_reflog_for_walk’ git-2.53.0/reflog-walk.c:160:29: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 160 | char *branch, *at = strchr(name, '@'); # | ^~~~~~ # 158| struct string_list_item *item; # 159| struct complete_reflogs *reflogs; # 160|-> char *branch, *at = strchr(name, '@'); # 161| struct commit_reflog *commit_reflog; # 162| enum selector_type selector = SELECTOR_NONE; Error: COMPILER_WARNING (CWE-704): [#def99] git-2.53.0/reflog-walk.c:160:29: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 158| struct string_list_item *item; # 159| struct complete_reflogs *reflogs; # 160|-> char *branch, *at = strchr(name, '@'); # 161| struct commit_reflog *commit_reflog; # 162| enum selector_type selector = SELECTOR_NONE; Error: COMPILER_WARNING (CWE-704): [#def100] git-2.53.0/refs/files-backend.c: scope_hint: In function ‘show_one_reflog_ent’ git-2.53.0/refs/files-backend.c:2192:25: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 2192 | !(email_end = strchr(p, '>')) || # | ^ # 2190| parse_oid_hex_algop(p, &ooid, &p, refs->base.repo->hash_algo) || *p++ != ' ' || # 2191| parse_oid_hex_algop(p, &noid, &p, refs->base.repo->hash_algo) || *p++ != ' ' || # 2192|-> !(email_end = strchr(p, '>')) || # 2193| email_end[1] != ' ' || # 2194| !(timestamp = parse_timestamp(email_end + 2, &message, 10)) || Error: COMPILER_WARNING (CWE-704): [#def101] git-2.53.0/refs/files-backend.c:2192:25: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 2190| parse_oid_hex_algop(p, &ooid, &p, refs->base.repo->hash_algo) || *p++ != ' ' || # 2191| parse_oid_hex_algop(p, &noid, &p, refs->base.repo->hash_algo) || *p++ != ' ' || # 2192|-> !(email_end = strchr(p, '>')) || # 2193| email_end[1] != ' ' || # 2194| !(timestamp = parse_timestamp(email_end + 2, &message, 10)) || Error: GCC_ANALYZER_WARNING (CWE-476): [#def102] git-2.53.0/remote.c:1996:29: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ git-2.53.0/remote.c:2054:5: enter_function: entry to ‘get_fetch_map’ git-2.53.0/remote.c:2061:12: branch_false: following ‘false’ branch... git-2.53.0/remote.c:2064:13: branch_false: ...to here git-2.53.0/remote.c:2064:12: branch_true: following ‘true’ branch... git-2.53.0/remote.c:2065:27: branch_true: ...to here git-2.53.0/remote.c:2065:27: call_function: calling ‘get_expanded_map’ from ‘get_fetch_map’ # 1994| struct ref *cpy = copy_ref(ref); # 1995| # 1996|-> if (cpy->peer_ref) # 1997| free_one_ref(cpy->peer_ref); # 1998| cpy->peer_ref = alloc_ref(expn_name); Error: GCC_ANALYZER_WARNING (CWE-476): [#def103] git-2.53.0/remote.c:1996:29: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ret’ git-2.53.0/remote.c:1976:20: enter_function: entry to ‘get_expanded_map’ git-2.53.0/remote.c:1981:21: release_memory: ‘ret’ is NULL git-2.53.0/remote.c:1984:33: branch_true: following ‘true’ branch (when ‘ref’ is non-NULL)... git-2.53.0/remote.c:1985:23: branch_true: ...to here git-2.53.0/remote.c:1987:17: call_function: calling ‘strbuf_setlen’ from ‘get_expanded_map’ git-2.53.0/remote.c:1987:17: return_function: returning to ‘get_expanded_map’ from ‘strbuf_setlen’ git-2.53.0/remote.c:1989:20: branch_false: following ‘false’ branch... git-2.53.0/remote.c:1992:45: branch_false: ...to here git-2.53.0/remote.c:1984:33: branch_true: following ‘true’ branch (when ‘ref’ is non-NULL)... git-2.53.0/remote.c:1985:23: branch_true: ...to here git-2.53.0/remote.c:1987:17: call_function: calling ‘strbuf_setlen’ from ‘get_expanded_map’ git-2.53.0/remote.c:1987:17: return_function: returning to ‘get_expanded_map’ from ‘strbuf_setlen’ git-2.53.0/remote.c:1989:20: branch_false: following ‘false’ branch... git-2.53.0/remote.c:1992:45: branch_false: ...to here git-2.53.0/remote.c:1991:21: branch_true: following ‘true’ branch... git-2.53.0/remote.c:1994:43: branch_true: ...to here git-2.53.0/remote.c:1994:43: call_function: calling ‘copy_ref’ from ‘get_expanded_map’ git-2.53.0/remote.c:1994:43: return_function: returning to ‘get_expanded_map’ from ‘copy_ref’ git-2.53.0/remote.c:1996:29: danger: dereference of NULL ‘copy_ref(ref)’ # 1994| struct ref *cpy = copy_ref(ref); # 1995| # 1996|-> if (cpy->peer_ref) # 1997| free_one_ref(cpy->peer_ref); # 1998| cpy->peer_ref = alloc_ref(expn_name); Error: COMPILER_WARNING (CWE-704): [#def104] git-2.53.0/revision.c: scope_hint: In function ‘handle_dotdot’ git-2.53.0/revision.c:2134:24: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 2134 | char *dotdot = strstr(arg, ".."); # | ^~~~~~ # 2132| { # 2133| struct object_context a_oc = {0}, b_oc = {0}; # 2134|-> char *dotdot = strstr(arg, ".."); # 2135| int ret; # 2136| Error: COMPILER_WARNING (CWE-704): [#def105] git-2.53.0/revision.c:2134:24: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 2132| { # 2133| struct object_context a_oc = {0}, b_oc = {0}; # 2134|-> char *dotdot = strstr(arg, ".."); # 2135| int ret; # 2136| Error: COMPILER_WARNING (CWE-704): [#def106] git-2.53.0/revision.c: scope_hint: In function ‘handle_revision_arg_1’ git-2.53.0/revision.c:2178:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 2178 | mark = strstr(arg, "^@"); # | ^ # 2176| } # 2177| # 2178|-> mark = strstr(arg, "^@"); # 2179| if (mark && !mark[2]) { # 2180| *mark = 0; Error: COMPILER_WARNING (CWE-704): [#def107] git-2.53.0/revision.c:2178:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 2176| } # 2177| # 2178|-> mark = strstr(arg, "^@"); # 2179| if (mark && !mark[2]) { # 2180| *mark = 0; Error: COMPILER_WARNING (CWE-704): [#def108] git-2.53.0/revision.c:2187:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 2187 | mark = strstr(arg, "^!"); # | ^ # 2185| *mark = '^'; # 2186| } # 2187|-> mark = strstr(arg, "^!"); # 2188| if (mark && !mark[2]) { # 2189| *mark = 0; Error: COMPILER_WARNING (CWE-704): [#def109] git-2.53.0/revision.c:2187:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 2185| *mark = '^'; # 2186| } # 2187|-> mark = strstr(arg, "^!"); # 2188| if (mark && !mark[2]) { # 2189| *mark = 0; Error: COMPILER_WARNING (CWE-704): [#def110] git-2.53.0/revision.c:2193:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 2193 | mark = strstr(arg, "^-"); # | ^ # 2191| *mark = '^'; # 2192| } # 2193|-> mark = strstr(arg, "^-"); # 2194| if (mark) { # 2195| int exclude_parent = 1; Error: COMPILER_WARNING (CWE-704): [#def111] git-2.53.0/revision.c:2193:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 2191| *mark = '^'; # 2192| } # 2193|-> mark = strstr(arg, "^-"); # 2194| if (mark) { # 2195| int exclude_parent = 1; Error: COMPILER_WARNING (CWE-704): [#def112] git-2.53.0/run-command.c: scope_hint: In function ‘trace_add_env’ git-2.53.0/run-command.c:608:32: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 608 | char *equals = strchr(*e, '='); # | ^~~~~~ # 606| for (e = deltaenv; e && *e; e++) { # 607| struct strbuf key = STRBUF_INIT; # 608|-> char *equals = strchr(*e, '='); # 609| # 610| if (equals) { Error: COMPILER_WARNING (CWE-704): [#def113] git-2.53.0/run-command.c:608:32: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 606| for (e = deltaenv; e && *e; e++) { # 607| struct strbuf key = STRBUF_INIT; # 608|-> char *equals = strchr(*e, '='); # 609| # 610| if (equals) { Error: COMPILER_WARNING (CWE-704): [#def114] git-2.53.0/send-pack.c: scope_hint: In function ‘receive_status’ git-2.53.0/send-pack.c:184:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 184 | p = strchr(head, ' '); # | ^ # 182| break; # 183| head = reader->line; # 184|-> p = strchr(head, ' '); # 185| if (!p) { # 186| error("invalid status line from remote: %s", reader->line); Error: COMPILER_WARNING (CWE-704): [#def115] git-2.53.0/send-pack.c:184:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 182| break; # 183| head = reader->line; # 184|-> p = strchr(head, ' '); # 185| if (!p) { # 186| error("invalid status line from remote: %s", reader->line); Error: COMPILER_WARNING (CWE-704): [#def116] git-2.53.0/send-pack.c:215:27: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 215 | p = strchr(key, ' '); # | ^ # 213| } # 214| key = p; # 215|-> p = strchr(key, ' '); # 216| if (p) # 217| *p++ = '\0'; Error: COMPILER_WARNING (CWE-704): [#def117] git-2.53.0/send-pack.c:215:27: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 213| } # 214| key = p; # 215|-> p = strchr(key, ' '); # 216| if (p) # 217| *p++ = '\0'; Error: COMPILER_WARNING (CWE-704): [#def118] git-2.53.0/send-pack.c:240:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 240 | p = strchr(refname, ' '); # | ^ # 238| } # 239| refname = p; # 240|-> p = strchr(refname, ' '); # 241| if (p) # 242| *p++ = '\0'; Error: COMPILER_WARNING (CWE-704): [#def119] git-2.53.0/send-pack.c:240:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 238| } # 239| refname = p; # 240|-> p = strchr(refname, ' '); # 241| if (p) # 242| *p++ = '\0'; Error: COMPILER_WARNING (CWE-704): [#def120] git-2.53.0/string-list.c: scope_hint: In function ‘split_string’ git-2.53.0/string-list.c:341:29: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 341 | end = strpbrk(p, delim); # | ^ # 339| end = NULL; # 340| else # 341|-> end = strpbrk(p, delim); # 342| # 343| count += append_one(list, p, end, in_place, flags); Error: COMPILER_WARNING (CWE-704): [#def121] git-2.53.0/string-list.c:341:29: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 339| end = NULL; # 340| else # 341|-> end = strpbrk(p, delim); # 342| # 343| count += append_one(list, p, end, in_place, flags); Error: COMPILER_WARNING (CWE-704): [#def122] git-2.53.0/t/unit-tests/clar/clar.c:1054: included_from: Included from here. git-2.53.0/t/unit-tests/clar/clar/print.h: scope_hint: In function ‘print_escaped’ git-2.53.0/t/unit-tests/clar/clar/print.h:132:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 132 | while ((c = strchr(str, '\'')) != NULL) { # | ^ # 130| char *c; # 131| # 132|-> while ((c = strchr(str, '\'')) != NULL) { # 133| printf("%.*s", (int)(c - str), str); # 134| printf("''"); Error: COMPILER_WARNING (CWE-704): [#def123] git-2.53.0/t/unit-tests/clar/clar/print.h:132:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 130| char *c; # 131| # 132|-> while ((c = strchr(str, '\'')) != NULL) { # 133| printf("%.*s", (int)(c - str), str); # 134| printf("''"); Error: COMPILER_WARNING (CWE-704): [#def124] git-2.53.0/transport-helper.c: scope_hint: In function ‘push_update_ref_status’ git-2.53.0/transport-helper.c:803:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 803 | p = strchr(key, ' '); # | ^ # 801| } # 802| key = buf->buf + 7; # 803|-> p = strchr(key, ' '); # 804| if (p) # 805| *p++ = '\0'; Error: COMPILER_WARNING (CWE-704): [#def125] git-2.53.0/transport-helper.c:803:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 801| } # 802| key = buf->buf + 7; # 803|-> p = strchr(key, ' '); # 804| if (p) # 805| *p++ = '\0'; Error: COMPILER_WARNING (CWE-704): [#def126] git-2.53.0/transport.c: scope_hint: In function ‘transport_anonymize_url’ git-2.53.0/transport.c:1663:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1663 | anon_part = strchr(url, '@'); # | ^ # 1661| size_t anon_len, prefix_len = 0; # 1662| # 1663|-> anon_part = strchr(url, '@'); # 1664| if (url_is_local_not_ssh(url) || !anon_part) # 1665| goto literal_copy; Error: COMPILER_WARNING (CWE-704): [#def127] git-2.53.0/transport.c:1663:19: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1661| size_t anon_len, prefix_len = 0; # 1662| # 1663|-> anon_part = strchr(url, '@'); # 1664| if (url_is_local_not_ssh(url) || !anon_part) # 1665| goto literal_copy; Error: COMPILER_WARNING (CWE-704): [#def128] git-2.53.0/transport.c:1668:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1668 | scheme_prefix = strstr(url, "://"); # | ^ # 1666| # 1667| anon_len = strlen(++anon_part); # 1668|-> scheme_prefix = strstr(url, "://"); # 1669| if (!scheme_prefix) { # 1670| if (!strchr(anon_part, ':')) Error: COMPILER_WARNING (CWE-704): [#def129] git-2.53.0/transport.c:1668:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 1666| # 1667| anon_len = strlen(++anon_part); # 1668|-> scheme_prefix = strstr(url, "://"); # 1669| if (!scheme_prefix) { # 1670| if (!strchr(anon_part, ':')) Error: COMPILER_WARNING (CWE-704): [#def130] git-2.53.0/wrapper.c: scope_hint: In function ‘xstrndup’ git-2.53.0/wrapper.c:118:19: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 118 | char *p = memchr(str, '\0', len); # | ^~~~~~ # 116| char *xstrndup(const char *str, size_t len) # 117| { # 118|-> char *p = memchr(str, '\0', len); # 119| return xmemdupz(str, p ? p - str : len); # 120| } Error: COMPILER_WARNING (CWE-704): [#def131] git-2.53.0/wrapper.c:118:19: warning[-Wdiscarded-qualifiers]: initialization discards ‘const’ qualifier from pointer target type # 116| char *xstrndup(const char *str, size_t len) # 117| { # 118|-> char *p = memchr(str, '\0', len); # 119| return xmemdupz(str, p ? p - str : len); # 120| }
| analyzer-version-clippy | 1.95.0 |
| analyzer-version-cppcheck | 2.20.0 |
| analyzer-version-gcc | 16.1.1 |
| analyzer-version-gcc-analyzer | 16.1.1 |
| analyzer-version-shellcheck | 0.11.0 |
| analyzer-version-unicontrol | 0.0.2 |
| diffbase-analyzer-version-clippy | 1.95.0 |
| diffbase-analyzer-version-cppcheck | 2.20.0 |
| diffbase-analyzer-version-gcc | 16.1.1 |
| diffbase-analyzer-version-gcc-analyzer | 16.1.1 |
| diffbase-analyzer-version-shellcheck | 0.11.0 |
| diffbase-analyzer-version-unicontrol | 0.0.2 |
| diffbase-enabled-plugins | clippy, cppcheck, gcc, shellcheck, unicontrol |
| diffbase-exit-code | 0 |
| diffbase-host | ip-172-16-1-101.us-west-2.compute.internal |
| diffbase-known-false-positives | /usr/share/csmock/known-false-positives.js |
| diffbase-known-false-positives-rpm | known-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch |
| diffbase-mock-config | fedora-rawhide-x86_64 |
| diffbase-project-name | git-2.54.0-1.fc45 |
| diffbase-store-results-to | /tmp/tmpng9dcbmz/git-2.54.0-1.fc45.tar.xz |
| diffbase-time-created | 2026-06-01 12:20:55 |
| diffbase-time-finished | 2026-06-01 12:26:39 |
| diffbase-tool | csmock |
| diffbase-tool-args | '/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,cppcheck,clippy,unicontrol,gcc' '-o' '/tmp/tmpng9dcbmz/git-2.54.0-1.fc45.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpng9dcbmz/git-2.54.0-1.fc45.src.rpm' |
| diffbase-tool-version | csmock-3.8.5.20260529.133039.g6f3b5c6-1.el9 |
| enabled-plugins | clippy, cppcheck, gcc, shellcheck, unicontrol |
| exit-code | 0 |
| host | ip-172-16-1-101.us-west-2.compute.internal |
| known-false-positives | /usr/share/csmock/known-false-positives.js |
| known-false-positives-rpm | known-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch |
| mock-config | fedora-rawhide-x86_64 |
| project-name | git-2.53.0-1.fc44 |
| store-results-to | /tmp/tmpot1cy0jh/git-2.53.0-1.fc44.tar.xz |
| time-created | 2026-06-01 12:14:25 |
| time-finished | 2026-06-01 12:20:40 |
| title | Fixed findings |
| tool | csmock |
| tool-args | '/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,cppcheck,clippy,unicontrol,gcc' '-o' '/tmp/tmpot1cy0jh/git-2.53.0-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpot1cy0jh/git-2.53.0-1.fc44.src.rpm' |
| tool-version | csmock-3.8.5.20260529.133039.g6f3b5c6-1.el9 |