diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2020-04-05 11:07:54 +0100 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2020-11-25 11:42:03 +0000 |
| commit | cb4bfbc99dffa7679f42cf8500931fa250bb7db3 (patch) | |
| tree | b3321a749eeba776074824d04f49fb47ddf978c1 /src/notes.c | |
| parent | a6dd58659d16207ec92a1f4d87ec620236ce4a23 (diff) | |
| download | libgit2-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/notes.c')
| -rw-r--r-- | src/notes.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/notes.c b/src/notes.c index 68d2ae9ec..a3c4b7c4f 100644 --- a/src/notes.c +++ b/src/notes.c @@ -629,9 +629,8 @@ int git_note_default_ref(git_buf *out, git_repository *repo) assert(out && repo); - git_buf_sanitize(out); - - if ((error = note_get_default_ref(&default_ref, repo)) < 0) + if ((error = git_buf_sanitize(out)) < 0 || + (error = note_get_default_ref(&default_ref, repo)) < 0) return error; git_buf_attach(out, default_ref, strlen(default_ref)); |
