diff options
author | Ben Straub <bs@github.com> | 2013-10-31 13:16:04 -0700 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2013-10-31 13:16:04 -0700 |
commit | 151b321898a4b24bfa25f0c4a6bacf6565e0cdb4 (patch) | |
tree | c197e9b99b7b106090ce7343bbbe58d1bdc268e7 /src | |
parent | 7be5104d241ce84537076ad92d2ac1604ea33b8a (diff) | |
download | libgit2-151b321898a4b24bfa25f0c4a6bacf6565e0cdb4.tar.gz |
Prevent segfault with a badly-formed URL
Diffstat (limited to 'src')
-rw-r--r-- | src/netops.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/netops.c b/src/netops.c index 7a61ef820..5f0db24ef 100644 --- a/src/netops.c +++ b/src/netops.c @@ -679,9 +679,10 @@ int gitno_extract_url_parts( slash = strchr(url, '/'); at = strchr(url, '@'); - if (slash == NULL) { - giterr_set(GITERR_NET, "Malformed URL: missing /"); - return -1; + if (!slash || + (colon && slash < colon)) { + giterr_set(GITERR_NET, "Malformed URL"); + return GIT_EINVALIDSPEC; } start = url; |