Prevent segfault with a badly-formed URL

This commit is contained in:
Ben Straub 2013-10-31 13:16:04 -07:00
parent 7be5104d24
commit 151b321898

View File

@ -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;