@matheusbsbs / matheus-bagliano / commits / b6c9fb5100
Fork 0

Prevent send-pack from segfaulting (backport from 'master')

4491e62ae932d5774f628d1bd3be663c11058a73 (Prevent send-pack from segfaulting when a branch doesn't match) is hereby cherry-picked back to 'maint'. If we can't find a source match, and we have no destination, we need to abort the match function early before we try to match the destination against the remote. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Oct 30, 2007 at 11:30 UTC b6c9fb5100f8cd4081f1c6df5aea7335a11e9659
1 file changed +4 -1
remote.c
+4 -1
@@ -504,8 +504,11 @@ static int match_explicit(struct ref *src, struct ref *dst,
504 if (!matched_src)
505 errs = 1;
506
507 - if (dst_value == NULL)
507 + if (!dst_value) {
508 + if (!matched_src)
509 + return errs;
510 dst_value = matched_src->name;
511 + }
512
513 switch (count_refspec_match(dst_value, dst, &matched_dst)) {
514 case 1: