git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 5/5] refspec.c: use rhs in parse_refspec instead of potentially uninitialized item->dst
@ 2018-05-30 17:04 Stefan Beller
  2018-06-01  2:01 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Beller @ 2018-05-30 17:04 UTC (permalink / raw)
  To: git; +Cc: bmwill, Stefan Beller

'item->dst' has not been assigned if '!rhs' is true. As the caller is allowed to pass in uninitialized
memory (we don't assume 'item' was zeroed out before calling), this fixes an access to
uninitialized memory.

Signed-off-by: Stefan Beller <sbeller@google.com>
---

applies on bw/refspec-api

 refspec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/refspec.c b/refspec.c
index c59a4ccf1e5..ea169dec0d3 100644
--- a/refspec.c
+++ b/refspec.c
@@ -108,7 +108,7 @@ static int parse_refspec(struct refspec_item *item, const char *refspec, int fet
 		 * - empty is not allowed.
 		 * - otherwise it must be a valid looking ref.
 		 */
-		if (!item->dst) {
+		if (!rhs) {
 			if (check_refname_format(item->src, flags))
 				return 0;
 		} else if (!*item->dst) {
-- 
2.17.0.582.gccdcbd54c44.dirty


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

end of thread, other threads:[~2018-06-01 19:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-30 17:04 [PATCH 5/5] refspec.c: use rhs in parse_refspec instead of potentially uninitialized item->dst Stefan Beller
2018-06-01  2:01 ` Junio C Hamano
2018-06-01  2:46   ` Junio C Hamano
2018-06-01 19:38     ` Stefan Beller

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).