From 178bd7db34f77e020fb8562890c5625ccbd67093 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 25 Dec 2014 23:55:03 +0100 Subject: url-parsing: reject CRLFs within URLs Bug: http://curl.haxx.se/docs/adv_20150108B.html Reported-by: Andrey Labunets --- lib/url.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/url.c b/lib/url.c index 788f04849..d3bb5e011 100644 --- a/lib/url.c +++ b/lib/url.c @@ -3842,6 +3842,13 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data, *prot_missing = FALSE; + /* We might pass the entire URL into the request so we need to make sure + * there are no bad characters in there.*/ + if(strpbrk(data->change.url, "\r\n")) { + failf(data, "Illegal characters found in URL"); + return CURLE_URL_MALFORMAT; + } + /************************************************************* * Parse the URL. * -- cgit v1.2.3