summaryrefslogtreecommitdiff
path: root/src/refs.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2020-04-05 11:22:19 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2020-11-25 11:42:03 +0000
commite0f3c33d5a505f5341300351c2fcc493929a932f (patch)
tree1591d06d80df6e7e68d6ad3bacf8305599243717 /src/refs.c
parentcb4bfbc99dffa7679f42cf8500931fa250bb7db3 (diff)
downloadlibgit2-e0f3c33d5a505f5341300351c2fcc493929a932f.tar.gz
buffer: git_buf_copy_cstr should return a value
`git_buf_copy_cstr` 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/refs.c')
-rw-r--r--src/refs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/refs.c b/src/refs.c
index 497b066d2..71594d73b 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -1024,7 +1024,8 @@ int git_reference_normalize_name(
goto cleanup;
}
- git_buf_copy_cstr(buffer_out, buffer_size, &buf);
+ if ((error = git_buf_copy_cstr(buffer_out, buffer_size, &buf)) < 0)
+ goto cleanup;
error = 0;