Prevent send-pack from segfaulting when a branch doesn't match

If `git push url foo` can't find a local branch named foo we can't
match it to any remote branch as the local branch is NULL and its
name is probably at position 0x34 in memory.  On most systems that
isn't a valid address for git-send-pack's virtual address space
and we segfault.

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: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 file changed
tree: 4a47cf0b2da34de6a673703e388dadd3442c1a6b
  1. arm/
  2. compat/
  3. contrib/
  4. Documentation/
  5. git-gui/
  6. gitweb/
  7. mozilla-sha1/
  8. perl/
  9. ppc/
  10. t/
  11. templates/
  12. xdiff/
  13. .gitignore
  14. .mailmap
  15. alloc.c
  16. archive-tar.c
  17. archive-zip.c
  18. archive.h
  19. attr.c
  20. attr.h
  21. base85.c
  22. blob.c
  23. blob.h
  24. builtin-add.c
  25. builtin-annotate.c
  26. builtin-apply.c
  27. builtin-archive.c
  28. builtin-blame.c
  29. builtin-branch.c
  30. builtin-bundle.c
  31. builtin-cat-file.c
  32. builtin-check-attr.c
  33. builtin-check-ref-format.c
  34. builtin-checkout-index.c
  35. builtin-commit-tree.c
  36. builtin-config.c
  37. builtin-count-objects.c
  38. builtin-describe.c
  39. builtin-diff-files.c
  40. builtin-diff-index.c
  41. builtin-diff-tree.c
  42. builtin-diff.c
  43. builtin-fetch--tool.c
  44. builtin-fetch-pack.c
  45. builtin-fetch.c
  46. builtin-fmt-merge-msg.c
  47. builtin-for-each-ref.c
  48. builtin-fsck.c
  49. builtin-gc.c
  50. builtin-grep.c
  51. builtin-http-fetch.c
  52. builtin-init-db.c
  53. builtin-log.c
  54. builtin-ls-files.c
  55. builtin-ls-tree.c
  56. builtin-mailinfo.c
  57. builtin-mailsplit.c
  58. builtin-merge-base.c
  59. builtin-merge-file.c
  60. builtin-mv.c
  61. builtin-name-rev.c
  62. builtin-pack-objects.c
  63. builtin-pack-refs.c
  64. builtin-prune-packed.c
  65. builtin-prune.c
  66. builtin-push.c
  67. builtin-read-tree.c
  68. builtin-reflog.c
  69. builtin-rerere.c
  70. builtin-reset.c
  71. builtin-rev-list.c
  72. builtin-rev-parse.c
  73. builtin-revert.c
  74. builtin-rm.c
  75. builtin-runstatus.c
  76. builtin-shortlog.c
  77. builtin-show-branch.c
  78. builtin-show-ref.c
  79. builtin-stripspace.c
  80. builtin-symbolic-ref.c
  81. builtin-tag.c
  82. builtin-tar-tree.c
  83. builtin-unpack-objects.c
  84. builtin-update-index.c
  85. builtin-update-ref.c
  86. builtin-upload-archive.c
  87. builtin-verify-pack.c
  88. builtin-verify-tag.c
  89. builtin-write-tree.c
  90. builtin.h
  91. bundle.c
  92. bundle.h
  93. cache-tree.c
  94. cache-tree.h
  95. cache.h
  96. check-builtins.sh
  97. check-racy.c
  98. color.c
  99. color.h
  100. combine-diff.c
  101. commit.c
  102. commit.h
  103. config.c
  104. config.mak.in
  105. configure.ac
  106. connect.c
  107. convert-objects.c
  108. convert.c
  109. copy.c
  110. COPYING
  111. csum-file.c
  112. csum-file.h
  113. ctype.c
  114. daemon.c
  115. date.c
  116. decorate.c
  117. decorate.h
  118. delta.h
  119. diff-delta.c
  120. diff-lib.c
  121. diff.c
  122. diff.h
  123. diffcore-break.c
  124. diffcore-delta.c
  125. diffcore-order.c
  126. diffcore-pickaxe.c
  127. diffcore-rename.c
  128. diffcore.h
  129. dir.c
  130. dir.h
  131. dump-cache-tree.c
  132. entry.c
  133. environment.c
  134. exec_cmd.c
  135. exec_cmd.h
  136. fast-import.c
  137. fetch-pack.h
  138. fixup-builtins
  139. generate-cmdlist.sh
  140. git-add--interactive.perl
  141. git-am.sh
  142. git-archimport.perl
  143. git-bisect.sh
  144. git-checkout.sh
  145. git-clean.sh
  146. git-clone.sh
  147. git-commit.sh
  148. git-compat-util.h
  149. git-cvsexportcommit.perl
  150. git-cvsimport.perl
  151. git-cvsserver.perl
  152. git-filter-branch.sh
  153. git-instaweb.sh
  154. git-lost-found.sh
  155. git-ls-remote.sh
  156. git-merge-octopus.sh
  157. git-merge-one-file.sh
  158. git-merge-ours.sh
  159. git-merge-resolve.sh
  160. git-merge-stupid.sh
  161. git-merge.sh
  162. git-mergetool.sh
  163. git-parse-remote.sh
  164. git-pull.sh
  165. git-quiltimport.sh
  166. git-rebase--interactive.sh
  167. git-rebase.sh
  168. git-relink.perl
  169. git-remote.perl
  170. git-repack.sh
  171. git-request-pull.sh
  172. git-send-email.perl
  173. git-sh-setup.sh
  174. git-stash.sh
  175. git-submodule.sh
  176. git-svn.perl
  177. git-svnimport.perl
  178. GIT-VERSION-GEN
  179. git.c
  180. git.spec.in
  181. gitk
  182. grep.c
  183. grep.h
  184. hash-object.c
  185. help.c
  186. http-push.c
  187. http-walker.c
  188. http.c
  189. http.h
  190. ident.c
  191. imap-send.c
  192. index-pack.c
  193. INSTALL
  194. interpolate.c
  195. interpolate.h
  196. list-objects.c
  197. list-objects.h
  198. lockfile.c
  199. log-tree.c
  200. log-tree.h
  201. mailmap.c
  202. mailmap.h
  203. Makefile
  204. match-trees.c
  205. merge-file.c
  206. merge-index.c
  207. merge-recursive.c
  208. merge-tree.c
  209. mktag.c
  210. mktree.c
  211. object-refs.c
  212. object.c
  213. object.h
  214. pack-check.c
  215. pack-redundant.c
  216. pack-write.c
  217. pack.h
  218. pager.c
  219. patch-delta.c
  220. patch-id.c
  221. patch-ids.c
  222. patch-ids.h
  223. path-list.c
  224. path-list.h
  225. path.c
  226. peek-remote.c
  227. pkt-line.c
  228. pkt-line.h
  229. progress.c
  230. progress.h
  231. quote.c
  232. quote.h
  233. reachable.c
  234. reachable.h
  235. read-cache.c
  236. README
  237. receive-pack.c
  238. reflog-walk.c
  239. reflog-walk.h
  240. refs.c
  241. refs.h
  242. remote.c
  243. remote.h
  244. revision.c
  245. revision.h
  246. run-command.c
  247. run-command.h
  248. send-pack.c
  249. server-info.c
  250. setup.c
  251. sha1_file.c
  252. sha1_name.c
  253. shallow.c
  254. shell.c
  255. show-index.c
  256. sideband.c
  257. sideband.h
  258. strbuf.c
  259. strbuf.h
  260. symlinks.c
  261. tag.c
  262. tag.h
  263. tar.h
  264. test-absolute-path.c
  265. test-chmtime.c
  266. test-date.c
  267. test-delta.c
  268. test-genrandom.c
  269. test-match-trees.c
  270. test-sha1.c
  271. test-sha1.sh
  272. trace.c
  273. transport.c
  274. transport.h
  275. tree-diff.c
  276. tree-walk.c
  277. tree-walk.h
  278. tree.c
  279. tree.h
  280. unpack-file.c
  281. unpack-trees.c
  282. unpack-trees.h
  283. update-server-info.c
  284. upload-pack.c
  285. usage.c
  286. utf8.c
  287. utf8.h
  288. var.c
  289. walker.c
  290. walker.h
  291. write_or_die.c
  292. wt-status.c
  293. wt-status.h
  294. xdiff-interface.c
  295. xdiff-interface.h