Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keller <jacob.keller@gmail.com>2020-08-15 03:25:08 +0300
committerJunio C Hamano <gitster@pobox.com>2020-08-17 20:39:21 +0300
commit95e7c385393488cb20c29697d8655f94ce83c413 (patch)
tree2ff928e09a57dc3ddf3f7e4abb30a37cd1de9abb /builtin/remote.c
parent0becfec5b154c37a0cd2d3f7a6a0c908ba7b5c1e (diff)
refspec: make sure stack refspec_item variables are zeroed
A couple of functions that used struct refspec_item did not zero out the structure memory. This can result in unexpected behavior, especially if additional parameters are ever added to refspec_item in the future. Use memset to ensure that unset structure members are zero. It may make sense to convert most of these uses of struct refspec_item to use either struct initializers or refspec_item_init_or_die. However, other similar code uses memset. Converting all of these uses has been left as a future exercise. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/remote.c')
-rw-r--r--builtin/remote.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/remote.c b/builtin/remote.c
index c8240e9fcd..542f56e387 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -478,6 +478,7 @@ static int get_head_names(const struct ref *remote_refs, struct ref_states *stat
struct ref *fetch_map = NULL, **fetch_map_tail = &fetch_map;
struct refspec_item refspec;
+ memset(&refspec, 0, sizeof(refspec));
refspec.force = 0;
refspec.pattern = 1;
refspec.src = refspec.dst = "refs/heads/*";