diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-02-09 23:41:13 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-02-12 22:54:46 -0500 |
commit | 392702ee2c88d7d8aaff25f7a84acb73606f9094 (patch) | |
tree | 97a66fe6e488797c6a9c2680ccb31964f61fe340 /src/diff.c | |
parent | d24a5312d8ab6d3cdb259e450ec9f1e2e6f3399d (diff) | |
download | libgit2-392702ee2c88d7d8aaff25f7a84acb73606f9094.tar.gz |
allocations: test for overflow of requested size
Introduce some helper macros to test integer overflow from arithmetic
and set error message appropriately.
Diffstat (limited to 'src/diff.c')
-rw-r--r-- | src/diff.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/diff.c b/src/diff.c index e23d3891f..75e9ae9a3 100644 --- a/src/diff.c +++ b/src/diff.c @@ -1558,8 +1558,10 @@ int git_diff_format_email( goto on_error; } + GITERR_CHECK_ALLOC_ADD(offset, 1); summary = git__calloc(offset + 1, sizeof(char)); GITERR_CHECK_ALLOC(summary); + strncpy(summary, opts->summary, offset); } |