http-fetch: fix alternates handling.

Fetch over http from a repository that uses alternates to borrow
from neighbouring repositories were quite broken, apparently for
some time now.

We parse input and count bytes to allocate the new buffer, and
when we copy into that buffer we know exactly how many bytes we
want to copy from where.  Using strlcpy for it was simply
stupid, and the code forgot to take it into account that strlcpy
terminated the string with NUL.

Signed-off-by: Junio C Hamano <junkio@cox.net>
1 file changed
tree: 13b3c830cc345cdc9eb54c99578380b51e26f61e
  1. arm/
  2. compat/
  3. contrib/
  4. Documentation/
  5. gitweb/
  6. mozilla-sha1/
  7. ppc/
  8. t/
  9. templates/
  10. xdiff/
  11. .gitignore
  12. alloc.c
  13. base85.c
  14. blame.c
  15. blob.c
  16. blob.h
  17. builtin-add.c
  18. builtin-apply.c
  19. builtin-cat-file.c
  20. builtin-check-ref-format.c
  21. builtin-checkout-index.c
  22. builtin-commit-tree.c
  23. builtin-count-objects.c
  24. builtin-diff-files.c
  25. builtin-diff-index.c
  26. builtin-diff-stages.c
  27. builtin-diff-tree.c
  28. builtin-diff.c
  29. builtin-fmt-merge-msg.c
  30. builtin-grep.c
  31. builtin-init-db.c
  32. builtin-log.c
  33. builtin-ls-files.c
  34. builtin-ls-tree.c
  35. builtin-mailinfo.c
  36. builtin-mailsplit.c
  37. builtin-mv.c
  38. builtin-name-rev.c
  39. builtin-pack-objects.c
  40. builtin-prune-packed.c
  41. builtin-prune.c
  42. builtin-push.c
  43. builtin-read-tree.c
  44. builtin-repo-config.c
  45. builtin-rev-list.c
  46. builtin-rev-parse.c
  47. builtin-rm.c
  48. builtin-show-branch.c
  49. builtin-stripspace.c
  50. builtin-symbolic-ref.c
  51. builtin-tar-tree.c
  52. builtin-unpack-objects.c
  53. builtin-update-index.c
  54. builtin-update-ref.c
  55. builtin-upload-tar.c
  56. builtin-verify-pack.c
  57. builtin-write-tree.c
  58. builtin-zip-tree.c
  59. builtin.h
  60. cache-tree.c
  61. cache-tree.h
  62. cache.h
  63. check-racy.c
  64. combine-diff.c
  65. commit.c
  66. commit.h
  67. config.c
  68. config.mak.in
  69. configure.ac
  70. connect.c
  71. convert-objects.c
  72. copy.c
  73. COPYING
  74. csum-file.c
  75. csum-file.h
  76. ctype.c
  77. daemon.c
  78. date.c
  79. delta.h
  80. describe.c
  81. diff-delta.c
  82. diff-lib.c
  83. diff.c
  84. diff.h
  85. diffcore-break.c
  86. diffcore-delta.c
  87. diffcore-order.c
  88. diffcore-pickaxe.c
  89. diffcore-rename.c
  90. diffcore.h
  91. dir.c
  92. dir.h
  93. dump-cache-tree.c
  94. entry.c
  95. environment.c
  96. exec_cmd.c
  97. exec_cmd.h
  98. fetch-clone.c
  99. fetch-pack.c
  100. fetch.c
  101. fetch.h
  102. fsck-objects.c
  103. generate-cmdlist.sh
  104. git-am.sh
  105. git-annotate.perl
  106. git-applymbox.sh
  107. git-applypatch.sh
  108. git-archimport.perl
  109. git-bisect.sh
  110. git-branch.sh
  111. git-checkout.sh
  112. git-cherry.sh
  113. git-clean.sh
  114. git-clone.sh
  115. git-commit.sh
  116. git-compat-util.h
  117. git-cvsexportcommit.perl
  118. git-cvsimport.perl
  119. git-cvsserver.perl
  120. git-fetch.sh
  121. git-instaweb.sh
  122. git-lost-found.sh
  123. git-ls-remote.sh
  124. git-merge-octopus.sh
  125. git-merge-one-file.sh
  126. git-merge-ours.sh
  127. git-merge-recursive.py
  128. git-merge-resolve.sh
  129. git-merge-stupid.sh
  130. git-merge.sh
  131. git-p4import.py
  132. git-parse-remote.sh
  133. git-pull.sh
  134. git-quiltimport.sh
  135. git-rebase.sh
  136. git-relink.perl
  137. git-repack.sh
  138. git-request-pull.sh
  139. git-rerere.perl
  140. git-reset.sh
  141. git-resolve.sh
  142. git-revert.sh
  143. git-send-email.perl
  144. git-sh-setup.sh
  145. git-shortlog.perl
  146. git-svn.perl
  147. git-svnimport.perl
  148. git-tag.sh
  149. git-verify-tag.sh
  150. GIT-VERSION-GEN
  151. git.c
  152. git.spec.in
  153. gitk
  154. gitMergeCommon.py
  155. hash-object.c
  156. help.c
  157. http-fetch.c
  158. http-push.c
  159. http.c
  160. http.h
  161. ident.c
  162. imap-send.c
  163. index-pack.c
  164. INSTALL
  165. local-fetch.c
  166. lockfile.c
  167. log-tree.c
  168. log-tree.h
  169. Makefile
  170. merge-base.c
  171. merge-file.c
  172. merge-index.c
  173. merge-recursive.c
  174. merge-tree.c
  175. mktag.c
  176. mktree.c
  177. object-refs.c
  178. object.c
  179. object.h
  180. pack-check.c
  181. pack-redundant.c
  182. pack.h
  183. pager.c
  184. patch-delta.c
  185. patch-id.c
  186. path-list.c
  187. path-list.h
  188. path.c
  189. peek-remote.c
  190. pkt-line.c
  191. pkt-line.h
  192. quote.c
  193. quote.h
  194. read-cache.c
  195. README
  196. receive-pack.c
  197. refs.c
  198. refs.h
  199. revision.c
  200. revision.h
  201. rsh.c
  202. rsh.h
  203. run-command.c
  204. run-command.h
  205. send-pack.c
  206. server-info.c
  207. setup.c
  208. sha1_file.c
  209. sha1_name.c
  210. shell.c
  211. show-index.c
  212. ssh-fetch.c
  213. ssh-pull.c
  214. ssh-push.c
  215. ssh-upload.c
  216. strbuf.c
  217. strbuf.h
  218. tag.c
  219. tag.h
  220. tar.h
  221. test-date.c
  222. test-delta.c
  223. test-sha1.c
  224. test-sha1.sh
  225. trace.c
  226. tree-diff.c
  227. tree-walk.c
  228. tree-walk.h
  229. tree.c
  230. tree.h
  231. unpack-file.c
  232. unpack-trees.c
  233. unpack-trees.h
  234. update-server-info.c
  235. upload-pack.c
  236. usage.c
  237. var.c
  238. write_or_die.c
  239. xdiff-interface.c
  240. xdiff-interface.h