]> git.ipfire.org Git - thirdparty/git.git/commit - refs.c
use st_add and st_mult for allocation size computation
authorJeff King <peff@peff.net>
Mon, 22 Feb 2016 22:44:35 +0000 (17:44 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Feb 2016 22:51:09 +0000 (14:51 -0800)
commit50a6c8efa2bbeddf46ca34c7765024108202e04b
tree0c189695ed6ad8349527cb03d326ef3fb39707cf
parent96ffc06f72f693d80f05059a1f0e5ca9007d5f1b
use st_add and st_mult for allocation size computation

If our size computation overflows size_t, we may allocate a
much smaller buffer than we expected and overflow it. It's
probably impossible to trigger an overflow in most of these
sites in practice, but it is easy enough convert their
additions and multiplications into overflow-checking
variants. This may be fixing real bugs, and it makes
auditing the code easier.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
25 files changed:
archive.c
builtin/apply.c
builtin/clean.c
builtin/fetch.c
builtin/index-pack.c
builtin/merge.c
builtin/mv.c
builtin/receive-pack.c
combine-diff.c
commit.c
compat/mingw.c
compat/qsort.c
compat/setenv.c
compat/win32/syslog.c
diffcore-delta.c
diffcore-rename.c
dir.c
fast-import.c
refs.c
remote.c
revision.c
sha1_file.c
sha1_name.c
shallow.c
submodule.c