You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2021/09/07 14:42:15 UTC

svn commit: r1893044 - /httpd/httpd/trunk/server/protocol.c

Author: ylavic
Date: Tue Sep  7 14:42:15 2021
New Revision: 1893044

URL: http://svn.apache.org/viewvc?rev=1893044&view=rev
Log:
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.

Modified:
    httpd/httpd/trunk/server/protocol.c

Modified: httpd/httpd/trunk/server/protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/protocol.c?rev=1893044&r1=1893043&r2=1893044&view=diff
==============================================================================
--- httpd/httpd/trunk/server/protocol.c (original)
+++ httpd/httpd/trunk/server/protocol.c Tue Sep  7 14:42:15 2021
@@ -681,6 +681,8 @@ static int field_name_len(const char *fi
     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->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 *c
                               "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");
             }