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, '/'); slash = strchr(url, '/');
at = strchr(url, '@'); at = strchr(url, '@');
if (slash == NULL) { if (!slash ||
giterr_set(GITERR_NET, "Malformed URL: missing /"); (colon && slash < colon)) {
return -1; giterr_set(GITERR_NET, "Malformed URL");
return GIT_EINVALIDSPEC;
} }
start = url; start = url;