diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-05-27 13:59:10 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-05-27 13:59:11 -0700 |
| commit | f9cdaa2860e20f3f36595646b7a82082aa772df8 (patch) | |
| tree | 40513df8eb4aec40cc4ec28e0ba4855d532be476 /bundle-uri.c | |
| parent | d8b48af39141d4552e6e2c091957a59b806808a1 (diff) | |
| parent | 22488332393646cfa4263bcb24836f492876406e (diff) | |
| download | git-f9cdaa2860e20f3f36595646b7a82082aa772df8.tar.gz | |
Merge branch 'js/misc-fixes'
Assorted fixes for issues found with CodeQL.
* js/misc-fixes:
sequencer: stop pretending that an assignment is a condition
bundle-uri: avoid using undefined output of `sscanf()`
commit-graph: avoid using stale stack addresses
trace2: avoid "futile conditional"
Avoid redundant conditions
fetch: avoid unnecessary work when there is no current branch
has_dir_name(): make code more obvious
upload-pack: rename `enum` to reflect the operation
commit-graph: avoid malloc'ing a local variable
fetch: carefully clear local variable's address after use
commit: simplify code
Diffstat (limited to 'bundle-uri.c')
| -rw-r--r-- | bundle-uri.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/bundle-uri.c b/bundle-uri.c index dc120664d1..9accf157b4 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -532,11 +532,13 @@ static int fetch_bundles_by_token(struct repository *r, */ if (!repo_config_get_value(r, "fetch.bundlecreationtoken", - &creationTokenStr) && - sscanf(creationTokenStr, "%"PRIu64, &maxCreationToken) == 1 && - bundles.items[0]->creationToken <= maxCreationToken) { - free(bundles.items); - return 0; + &creationTokenStr)) { + if (sscanf(creationTokenStr, "%"PRIu64, &maxCreationToken) != 1) + maxCreationToken = 0; + if (bundles.items[0]->creationToken <= maxCreationToken) { + free(bundles.items); + return 0; + } } /* |
