summaryrefslogtreecommitdiff
path: root/src/submodule.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/submodule.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/submodule.c')
-rw-r--r--src/submodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/submodule.c b/src/submodule.c
index c32b9770a..8fb3bdb73 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -998,7 +998,8 @@ int git_submodule_resolve_url(git_buf *out, git_repository *repo, const char *ur
assert(out && repo && url);
- git_buf_sanitize(out);
+ if ((error = git_buf_sanitize(out)) < 0)
+ return error;
/* We do this in all platforms in case someone on Windows created the .gitmodules */
if (strchr(url, '\\')) {