public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jiang Xin <worldhello.net@gmail•com>
To: Git List <git@vger•kernel.org>,
	Junio C Hamano <gitster@pobox•com>,
	Bruno Albuquerque <bga@google•com>
Cc: Jiang Xin <zhiyou.jx@alibaba-inc•com>
Subject: [PATCH] object-info: init request_info before reading arg
Date: Sun,  2 Apr 2023 21:05:57 +0800	[thread overview]
Message-ID: <20230402130557.17662-1-worldhello.net@gmail.com> (raw)

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


             reply	other threads:[~2023-04-02 13:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-02 13:05 Jiang Xin [this message]
2023-04-03 16:36 ` [PATCH] object-info: init request_info before reading arg Junio C Hamano
2023-04-04  1:07   ` Jiang Xin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230402130557.17662-1-worldhello.net@gmail.com \
    --to=worldhello.net@gmail$(echo .)com \
    --cc=bga@google$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=zhiyou.jx@alibaba-inc$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox