diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-03-25 23:27:00 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-03-25 23:27:00 +0100 |
commit | 85daa67bc2e0abc7c9661f7652a462185dd7f6b5 (patch) | |
tree | f8d27b8e6db9439ea7078e635ebbb4322816d51b | |
parent | c608731e78736ec177461577e505e250f2dd3614 (diff) | |
download | busybox-w32-85daa67bc2e0abc7c9661f7652a462185dd7f6b5.tar.gz busybox-w32-85daa67bc2e0abc7c9661f7652a462185dd7f6b5.tar.bz2 busybox-w32-85daa67bc2e0abc7c9661f7652a462185dd7f6b5.zip |
httpd: don't allow tabs and multiple spaces in request string
HTTP standard doesn't allow it and no sane clients should ever use it.
function old new delta
handle_incoming_and_exit 2795 2785 -10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/httpd.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index 1934bb27e..b46eb0fab 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -1964,7 +1964,9 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr) | |||
1964 | send_headers_and_exit(HTTP_BAD_REQUEST); | 1964 | send_headers_and_exit(HTTP_BAD_REQUEST); |
1965 | 1965 | ||
1966 | /* Determine type of request (GET/POST) */ | 1966 | /* Determine type of request (GET/POST) */ |
1967 | urlp = strpbrk(iobuf, " \t"); | 1967 | // rfc2616: method and URI is separated by exactly one space |
1968 | //urlp = strpbrk(iobuf, " \t"); - no, tab isn't allowed | ||
1969 | urlp = strchr(iobuf, ' '); | ||
1968 | if (urlp == NULL) | 1970 | if (urlp == NULL) |
1969 | send_headers_and_exit(HTTP_BAD_REQUEST); | 1971 | send_headers_and_exit(HTTP_BAD_REQUEST); |
1970 | *urlp++ = '\0'; | 1972 | *urlp++ = '\0'; |
@@ -1982,7 +1984,8 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr) | |||
1982 | if (strcasecmp(iobuf, request_GET) != 0) | 1984 | if (strcasecmp(iobuf, request_GET) != 0) |
1983 | send_headers_and_exit(HTTP_NOT_IMPLEMENTED); | 1985 | send_headers_and_exit(HTTP_NOT_IMPLEMENTED); |
1984 | #endif | 1986 | #endif |
1985 | urlp = skip_whitespace(urlp); | 1987 | // rfc2616: method and URI is separated by exactly one space |
1988 | //urlp = skip_whitespace(urlp); - should not be necessary | ||
1986 | if (urlp[0] != '/') | 1989 | if (urlp[0] != '/') |
1987 | send_headers_and_exit(HTTP_BAD_REQUEST); | 1990 | send_headers_and_exit(HTTP_BAD_REQUEST); |
1988 | 1991 | ||