Re: What's in git.git (stable)

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <gitster@...>
Cc: <git@...>
Date: Wednesday, June 18, 2008 - 6:59 am

On Wed, Jun 18, 2008 at 12:32:05AM -0700, Junio C Hamano wrote:


I sent out a code cleanup for remote.c yesterday that fixes a segfault:

  http://mid.gmane.org/20080616161502.GA7219@sigill.intra.peff.net

I am OK if it doesn't make it in to 1.5.6, but if not, then we should at
least apply the very safe one-liner that prevents the segfault. That
patch is below.

-- >8 --
fix segfault with "git push bogus:bogus"

We try to guess the type of the dst half of the refspec
based on the src half. If the src half is bogus, we ended up
dereferencing NULL.
---
 remote.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/remote.c b/remote.c
index 91e3b11..fd8c71a 100644
--- a/remote.c
+++ b/remote.c
@@ -920,7 +920,8 @@ static int match_explicit(struct ref *src, struct ref *dst,
 	case 0:
 		if (!memcmp(dst_value, "refs/", 5))
 			matched_dst = make_linked_ref(dst_value, dst_tail);
-		else if((dst_guess = guess_ref(dst_value, matched_src)))
+		else if(matched_src &&
+			(dst_guess = guess_ref(dst_value, matched_src)))
 			matched_dst = make_linked_ref(dst_guess, dst_tail);
 		else
 			error("unable to push to unqualified destination: %s\n"
-- 
1.5.6.rc3.160.g2a3c9

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
What's in git.git (stable), Junio C Hamano, (Wed Jun 18, 3:32 am)
What's in git.git (stable), Junio C Hamano, (Sat Jun 21, 6:06 am)
What's in git.git (stable), Junio C Hamano, (Mon Jun 23, 3:25 am)
What's in git.git (stable), Junio C Hamano, (Wed Jun 25, 5:34 am)
What's in git.git (stable), Junio C Hamano, (Wed Jul 2, 2:28 am)
Re: What's in git.git (stable), Jeff King, (Wed Jun 18, 6:59 am)