cache-tree: replace a sscanf() by two strtol() calls

On one of my systems, sscanf() first calls strlen() on the buffer. But
this buffer is not terminated by NUL. So git crashed.

strtol() does not share that problem, as it stops reading after the
first non-digit.

[jc: original patch was wrong and did not read the cache-tree
 structure correctly; this has been fixed up and tested minimally
 with fsck-objects. ]

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