git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] object-info: init request_info before reading arg
@ 2023-04-02 13:05 Jiang Xin
  2023-04-03 16:36 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Jiang Xin @ 2023-04-02 13:05 UTC (permalink / raw)
  To: Git List, Junio C Hamano, Bruno Albuquerque; +Cc: Jiang Xin

From: Jiang Xin <zhiyou.jx@alibaba-inc.com>

When retrieving object info via capability "object-info", we store the
command args into a requested_info variable, but forget to initialize
it. Initialize the variable before use to prevent unexpected output.

Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
---
 protocol-caps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/protocol-caps.c b/protocol-caps.c
index 874bc815b4..94c51862c5 100644
--- a/protocol-caps.c
+++ b/protocol-caps.c
@@ -79,7 +79,7 @@ static void send_info(struct repository *r, struct packet_writer *writer,
 
 int cap_object_info(struct repository *r, struct packet_reader *request)
 {
-	struct requested_info info;
+	struct requested_info info = { 0 };
 	struct packet_writer writer;
 	struct string_list oid_str_list = STRING_LIST_INIT_DUP;
 
-- 
2.39.1.418.g7876265d61


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-04  1:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-02 13:05 [PATCH] object-info: init request_info before reading arg Jiang Xin
2023-04-03 16:36 ` Junio C Hamano
2023-04-04  1:07   ` Jiang Xin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).