path: root/transport.c
diff options
authorJacob Keller <>2020-08-15 00:25:08 (GMT)
committerJunio C Hamano <>2020-08-17 17:39:21 (GMT)
commit95e7c385393488cb20c29697d8655f94ce83c413 (patch)
tree2ff928e09a57dc3ddf3f7e4abb30a37cd1de9abb /transport.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 <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'transport.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/transport.c b/transport.c
index 2d4fd85..419be0b 100644
--- a/transport.c
+++ b/transport.c
@@ -443,6 +443,7 @@ void transport_update_tracking_ref(struct remote *remote, struct ref *ref, int v
if (ref->status != REF_STATUS_OK && ref->status != REF_STATUS_UPTODATE)
+ memset(&rs, 0, sizeof(rs));
rs.src = ref->name;
rs.dst = NULL;