banned.h: mark sprintf() as banned

The sprintf() function (and its variadic form vsprintf) make
it easy to accidentally introduce a buffer overflow. If
you're thinking of using them, you're better off either
using a dynamic string (strbuf or xstrfmt), or xsnprintf if
you really know that you won't overflow. The last sprintf()
call went away quite a while ago in f0766bf94e (fsck: use
for_each_loose_file_in_objdir, 2015-09-24).

Note that we respect HAVE_VARIADIC_MACROS here, which some
ancient platforms lack. As a fallback, we can just "guess"
that the caller will provide 3 arguments. If they do, then
the macro will work as usual. If not, then they'll get a
slightly less useful error, like:

  git.c:718:24: error: macro "sprintf" passed 3 arguments, but takes just 2

That's not ideal, but it at least alerts them to the problem
area. And anyway, we're primarily targeting people adding
new code. Most developers should be on modern enough
platforms to see the normal "good" error message.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 file changed
tree: f24f38a5d58aef9c435bf12c7c3b5d402b922c93
  1. .github/
  2. block-sha1/
  3. builtin/
  4. ci/
  5. compat/
  6. contrib/
  7. Documentation/
  8. ewah/
  9. git-gui/
  10. gitk-git/
  11. gitweb/
  12. mergetools/
  13. perl/
  14. po/
  15. ppc/
  16. refs/
  17. sha1dc/
  18. t/
  19. templates/
  20. vcs-svn/
  21. xdiff/
  22. .clang-format
  23. .gitattributes
  24. .gitignore
  25. .gitmodules
  26. .mailmap
  27. .travis.yml
  28. .tsan-suppressions
  29. abspath.c
  30. aclocal.m4
  31. advice.c
  32. advice.h
  33. alias.c
  34. alias.h
  35. alloc.c
  36. alloc.h
  37. apply.c
  38. apply.h
  39. archive-tar.c
  40. archive-zip.c
  41. archive.c
  42. archive.h
  43. argv-array.c
  44. argv-array.h
  45. attr.c
  46. attr.h
  47. banned.h
  48. base85.c
  49. bisect.c
  50. bisect.h
  51. blame.c
  52. blame.h
  53. blob.c
  54. blob.h
  55. branch.c
  56. branch.h
  57. builtin.h
  58. bulk-checkin.c
  59. bulk-checkin.h
  60. bundle.c
  61. bundle.h
  62. cache-tree.c
  63. cache-tree.h
  64. cache.h
  65. chdir-notify.c
  66. chdir-notify.h
  67. check-builtins.sh
  68. check-racy.c
  69. check_bindir
  70. checkout.c
  71. checkout.h
  72. color.c
  73. color.h
  74. column.c
  75. column.h
  76. combine-diff.c
  77. command-list.txt
  78. commit-graph.c
  79. commit-graph.h
  80. commit-slab-decl.h
  81. commit-slab-impl.h
  82. commit-slab.h
  83. commit.c
  84. commit.h
  85. common-main.c
  86. config.c
  87. config.h
  88. config.mak.dev
  89. config.mak.in
  90. config.mak.uname
  91. configure.ac
  92. connect.c
  93. connect.h
  94. connected.c
  95. connected.h
  96. convert.c
  97. convert.h
  98. copy.c
  99. COPYING
  100. credential-cache--daemon.c
  101. credential-cache.c
  102. credential-store.c
  103. credential.c
  104. credential.h
  105. csum-file.c
  106. csum-file.h
  107. ctype.c
  108. daemon.c
  109. date.c
  110. decorate.c
  111. decorate.h
  112. delta.h
  113. detect-compiler
  114. diff-delta.c
  115. diff-lib.c
  116. diff-no-index.c
  117. diff.c
  118. diff.h
  119. diffcore-break.c
  120. diffcore-delta.c
  121. diffcore-order.c
  122. diffcore-pickaxe.c
  123. diffcore-rename.c
  124. diffcore.h
  125. dir-iterator.c
  126. dir-iterator.h
  127. dir.c
  128. dir.h
  129. editor.c
  130. entry.c
  131. environment.c
  132. exec-cmd.c
  133. exec-cmd.h
  134. fast-import.c
  135. fetch-object.c
  136. fetch-object.h
  137. fetch-pack.c
  138. fetch-pack.h
  139. fmt-merge-msg.h
  140. fsck.c
  141. fsck.h
  142. fsmonitor.c
  143. fsmonitor.h
  144. generate-cmdlist.sh
  145. gettext.c
  146. gettext.h
  147. git-add--interactive.perl
  148. git-archimport.perl
  149. git-bisect.sh
  150. git-compat-util.h
  151. git-cvsexportcommit.perl
  152. git-cvsimport.perl
  153. git-cvsserver.perl
  154. git-difftool--helper.sh
  155. git-filter-branch.sh
  156. git-instaweb.sh
  157. git-merge-octopus.sh
  158. git-merge-one-file.sh
  159. git-merge-resolve.sh
  160. git-mergetool--lib.sh
  161. git-mergetool.sh
  162. git-p4.py
  163. git-parse-remote.sh
  164. git-quiltimport.sh
  165. git-rebase--am.sh
  166. git-rebase--interactive.sh
  167. git-rebase--merge.sh
  168. git-rebase--preserve-merges.sh
  169. git-rebase.sh
  170. git-remote-testgit.sh
  171. git-request-pull.sh
  172. git-send-email.perl
  173. git-sh-i18n.sh
  174. git-sh-setup.sh
  175. git-stash.sh
  176. git-submodule.sh
  177. git-svn.perl
  178. GIT-VERSION-GEN
  179. git-web--browse.sh
  180. git.c
  181. git.rc
  182. gpg-interface.c
  183. gpg-interface.h
  184. graph.c
  185. graph.h
  186. grep.c
  187. grep.h
  188. hash.h
  189. hashmap.c
  190. hashmap.h
  191. help.c
  192. help.h
  193. hex.c
  194. http-backend.c
  195. http-fetch.c
  196. http-push.c
  197. http-walker.c
  198. http.c
  199. http.h
  200. ident.c
  201. imap-send.c
  202. INSTALL
  203. iterator.h
  204. khash.h
  205. kwset.c
  206. kwset.h
  207. levenshtein.c
  208. levenshtein.h
  209. LGPL-2.1
  210. line-log.c
  211. line-log.h
  212. line-range.c
  213. line-range.h
  214. list-objects-filter-options.c
  215. list-objects-filter-options.h
  216. list-objects-filter.c
  217. list-objects-filter.h
  218. list-objects.c
  219. list-objects.h
  220. list.h
  221. ll-merge.c
  222. ll-merge.h
  223. lockfile.c
  224. lockfile.h
  225. log-tree.c
  226. log-tree.h
  227. ls-refs.c
  228. ls-refs.h
  229. mailinfo.c
  230. mailinfo.h
  231. mailmap.c
  232. mailmap.h
  233. Makefile
  234. match-trees.c
  235. mem-pool.c
  236. mem-pool.h
  237. merge-blobs.c
  238. merge-blobs.h
  239. merge-recursive.c
  240. merge-recursive.h
  241. merge.c
  242. mergesort.c
  243. mergesort.h
  244. name-hash.c
  245. notes-cache.c
  246. notes-cache.h
  247. notes-merge.c
  248. notes-merge.h
  249. notes-utils.c
  250. notes-utils.h
  251. notes.c
  252. notes.h
  253. object-store.h
  254. object.c
  255. object.h
  256. oidmap.c
  257. oidmap.h
  258. oidset.c
  259. oidset.h
  260. pack-bitmap-write.c
  261. pack-bitmap.c
  262. pack-bitmap.h
  263. pack-check.c
  264. pack-objects.c
  265. pack-objects.h
  266. pack-revindex.c
  267. pack-revindex.h
  268. pack-write.c
  269. pack.h
  270. packfile.c
  271. packfile.h
  272. pager.c
  273. parse-options-cb.c
  274. parse-options.c
  275. parse-options.h
  276. patch-delta.c
  277. patch-ids.c
  278. patch-ids.h
  279. path.c
  280. path.h
  281. pathspec.c
  282. pathspec.h
  283. pkt-line.c
  284. pkt-line.h
  285. preload-index.c
  286. pretty.c
  287. pretty.h
  288. prio-queue.c
  289. prio-queue.h
  290. progress.c
  291. progress.h
  292. prompt.c
  293. prompt.h
  294. protocol.c
  295. protocol.h
  296. quote.c
  297. quote.h
  298. reachable.c
  299. reachable.h
  300. read-cache.c
  301. README.md
  302. ref-filter.c
  303. ref-filter.h
  304. reflog-walk.c
  305. reflog-walk.h
  306. refs.c
  307. refs.h
  308. refspec.c
  309. refspec.h
  310. remote-curl.c
  311. remote-testsvn.c
  312. remote.c
  313. remote.h
  314. replace-object.c
  315. replace-object.h
  316. repository.c
  317. repository.h
  318. rerere.c
  319. rerere.h
  320. resolve-undo.c
  321. resolve-undo.h
  322. revision.c
  323. revision.h
  324. run-command.c
  325. run-command.h
  326. send-pack.c
  327. send-pack.h
  328. sequencer.c
  329. sequencer.h
  330. serve.c
  331. serve.h
  332. server-info.c
  333. setup.c
  334. sh-i18n--envsubst.c
  335. sha1-array.c
  336. sha1-array.h
  337. sha1-file.c
  338. sha1-lookup.c
  339. sha1-lookup.h
  340. sha1-name.c
  341. sha1dc_git.c
  342. sha1dc_git.h
  343. shallow.c
  344. shell.c
  345. shortlog.h
  346. sideband.c
  347. sideband.h
  348. sigchain.c
  349. sigchain.h
  350. split-index.c
  351. split-index.h
  352. strbuf.c
  353. strbuf.h
  354. streaming.c
  355. streaming.h
  356. string-list.c
  357. string-list.h
  358. sub-process.c
  359. sub-process.h
  360. submodule-config.c
  361. submodule-config.h
  362. submodule.c
  363. submodule.h
  364. symlinks.c
  365. tag.c
  366. tag.h
  367. tar.h
  368. tempfile.c
  369. tempfile.h
  370. thread-utils.c
  371. thread-utils.h
  372. tmp-objdir.c
  373. tmp-objdir.h
  374. trace.c
  375. trace.h
  376. trailer.c
  377. trailer.h
  378. transport-helper.c
  379. transport-internal.h
  380. transport.c
  381. transport.h
  382. tree-diff.c
  383. tree-walk.c
  384. tree-walk.h
  385. tree.c
  386. tree.h
  387. unicode-width.h
  388. unimplemented.sh
  389. unix-socket.c
  390. unix-socket.h
  391. unpack-trees.c
  392. unpack-trees.h
  393. upload-pack.c
  394. upload-pack.h
  395. url.c
  396. url.h
  397. urlmatch.c
  398. urlmatch.h
  399. usage.c
  400. userdiff.c
  401. userdiff.h
  402. utf8.c
  403. utf8.h
  404. varint.c
  405. varint.h
  406. version.c
  407. version.h
  408. versioncmp.c
  409. walker.c
  410. walker.h
  411. wildmatch.c
  412. wildmatch.h
  413. worktree.c
  414. worktree.h
  415. wrap-for-bin.sh
  416. wrapper.c
  417. write-or-die.c
  418. ws.c
  419. wt-status.c
  420. wt-status.h
  421. xdiff-interface.c
  422. xdiff-interface.h
  423. zlib.c
README.md

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from https://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.txt to get started, then see Documentation/giteveryday.txt for a useful minimum set of commands, and Documentation/git-.txt for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.txt (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission). To subscribe to the list, send an email with just “subscribe git” in the body to majordomo@vger.kernel.org. The mailing list archives are available at https://public-inbox.org/git/, http://marc.info/?l=git and other archival sites.

Issues which are security relevant should be disclosed privately to the Git Security mailing list git-security@googlegroups.com.

The maintainer frequently sends the “What's cooking” reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name “git” was given by Linus Torvalds when he wrote the very first version. He described the tool as “the stupid content tracker” and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of “get” may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • “global information tracker”: you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • “goddamn idiotic truckload of sh*t”: when it breaks