]> granicus.if.org Git - libevent/commitdiff
http: allow non RFC3986 conformant during parsing request-line (http server)
authorAzat Khuzhin <a3at.mail@gmail.com>
Mon, 22 Oct 2018 20:52:46 +0000 (23:52 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Mon, 22 Oct 2018 21:12:03 +0000 (00:12 +0300)
Reported-by: lsdyst@163.com
http.c

diff --git a/http.c b/http.c
index 636ac5a31456de571327141492eac98f80322cf0..181352b63afe2257f39f42b54dd63523af9872e6 100644 (file)
--- a/http.c
+++ b/http.c
@@ -1707,14 +1707,14 @@ evhttp_parse_request_line(struct evhttp_request *req, char *line, size_t len)
 
        /* Parse the request line */
        method = strsep(&line, " ");
-       if (line == NULL)
-               return (-1);
-       uri = strsep(&line, " ");
-       if (line == NULL)
-               return (-1);
-       version = strsep(&line, " ");
-       if (line != NULL)
-               return (-1);
+       if (!line)
+               return -1;
+       uri = line;
+       version = strrchr(uri, ' ');
+       if (!version || uri == version)
+               return -1;
+       *version = '\0';
+       version++;
 
        method_len = (uri - method) - 1;
        type       = EVHTTP_REQ_UNKNOWN_;