diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-07-08 13:14:59 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-07-08 13:14:59 -0700 |
commit | 4677587e574aee4d9b07da4984cb3560162368d5 (patch) | |
tree | 74f6ffc50864cccdf0a6ebe8532d09e2104423fd | |
parent | Merge branch 'ah/uninitialized-reads-fix' (diff) | |
parent | add_pending_object_with_path(): work around "gcc -O3" complaint (diff) | |
download | tgif-4677587e574aee4d9b07da4984cb3560162368d5.tar.xz |
Merge branch 'jk/revision-squelch-gcc-warning'
Warning fix.
* jk/revision-squelch-gcc-warning:
add_pending_object_with_path(): work around "gcc -O3" complaint
-rw-r--r-- | revision.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/revision.c b/revision.c index 8140561b6c..cddd0542a6 100644 --- a/revision.c +++ b/revision.c @@ -316,9 +316,10 @@ static void add_pending_object_with_path(struct rev_info *revs, revs->no_walk = 0; if (revs->reflog_info && obj->type == OBJ_COMMIT) { struct strbuf buf = STRBUF_INIT; - int len = interpret_branch_name(name, 0, &buf, &options); + size_t namelen = strlen(name); + int len = interpret_branch_name(name, namelen, &buf, &options); - if (0 < len && name[len] && buf.len) + if (0 < len && len < namelen && buf.len) strbuf_addstr(&buf, name + len); add_reflog_for_walk(revs->reflog_info, (struct commit *)obj, |