diff options
author | Yann Ylavic <ylavic@apache.org> | 2021-09-07 16:42:15 +0200 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2021-09-07 16:42:15 +0200 |
commit | 6945bb23babfd87f53cd94cbc0d4eb0d03f7965d (patch) | |
tree | 5707154d61768634aa3f9025cb84e51bcad3f30c /server | |
parent | core: Initialize the request fields on read failure to avoid NULLs. (diff) | |
download | apache2-6945bb23babfd87f53cd94cbc0d4eb0d03f7965d.tar.xz apache2-6945bb23babfd87f53cd94cbc0d4eb0d03f7965d.zip |
core: Follow up to r1893030: Use special address for invalid r->method.
read_request_line() failure was cought by ap_parse_request() with r->method
being NULL, so have a .rodata pointer to "-" instead.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893044 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r-- | server/protocol.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/protocol.c b/server/protocol.c index 8d35247508..c4dc7b5763 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -681,6 +681,8 @@ static int field_name_len(const char *field) return end - field; } +static const char m_invalid_str[] = "-"; + static int read_request_line(request_rec *r, apr_bucket_brigade *bb) { apr_size_t len; @@ -717,7 +719,7 @@ static int read_request_line(request_rec *r, apr_bucket_brigade *bb) r->request_time = apr_time_now(); /* Fall through with an invalid (non NULL) request */ - r->method = "-"; + r->method = m_invalid_str; r->method_number = M_INVALID; r->uri = r->unparsed_uri = apr_pstrdup(r->pool, "-"); @@ -1488,7 +1490,7 @@ request_rec *ap_read_request(conn_rec *conn) "request failed: client's request-line exceeds LimitRequestLine (longer than %d)", r->server->limit_req_line); } - else if (r->method == NULL) { + else if (r->method == m_invalid_str) { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00566) "request failed: malformed request line"); } |