summaryrefslogtreecommitdiff
path: root/src/object.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/object.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/object.c')
-rw-r--r--src/object.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/object.c b/src/object.c
index 749b0caf2..fa975347e 100644
--- a/src/object.c
+++ b/src/object.c
@@ -495,7 +495,9 @@ int git_object_short_id(git_buf *out, const git_object *obj)
assert(out && obj);
- git_buf_sanitize(out);
+ if ((error = git_buf_sanitize(out)) < 0)
+ return error;
+
repo = git_object_owner(obj);
if ((error = git_repository__configmap_lookup(&len, repo, GIT_CONFIGMAP_ABBREV)) < 0)