]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
core: Follow up to r1893030: Use special address for invalid r->method.
authorYann Ylavic <ylavic@apache.org>
Tue, 7 Sep 2021 14:42:15 +0000 (14:42 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 7 Sep 2021 14:42:15 +0000 (14:42 +0000)
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

server/protocol.c

index 8d35247508ca8169becbf899dfcc6218fdef5b29..c4dc7b5763f151b10476648b5b612a96cf788e54 100644 (file)
@@ -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");
             }