summaryrefslogtreecommitdiff
path: root/src/pack-objects.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2020-04-05 11:07:54 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2020-11-25 11:42:03 +0000
commitcb4bfbc99dffa7679f42cf8500931fa250bb7db3 (patch)
treeb3321a749eeba776074824d04f49fb47ddf978c1 /src/pack-objects.c
parenta6dd58659d16207ec92a1f4d87ec620236ce4a23 (diff)
downloadlibgit2-cb4bfbc99dffa7679f42cf8500931fa250bb7db3.tar.gz
buffer: git_buf_sanitize should return a value
`git_buf_sanitize` is called with user-input, and wants to sanity-check that input. Allow it to return a value if the input was malformed in a way that we cannot cope.
Diffstat (limited to 'src/pack-objects.c')
-rw-r--r--src/pack-objects.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pack-objects.c b/src/pack-objects.c
index cf10e6cb5..9679e8e23 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -1363,8 +1363,13 @@ int git_packbuilder_foreach(git_packbuilder *pb, int (*cb)(void *buf, size_t siz
int git_packbuilder_write_buf(git_buf *buf, git_packbuilder *pb)
{
+ int error;
+
+ if ((error = git_buf_sanitize(buf)) < 0)
+ return error;
+
PREPARE_PACK;
- git_buf_sanitize(buf);
+
return write_pack(pb, &write_pack_buf, buf);
}