From: Yann Ylavic Date: Tue, 7 Sep 2021 14:42:15 +0000 (+0000) Subject: core: Follow up to r1893030: Use special address for invalid r->method. X-Git-Tag: 2.5.0-alpha2-ci-test-only~823 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6945bb23babfd87f53cd94cbc0d4eb0d03f7965d;p=thirdparty%2Fapache%2Fhttpd.git 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 --- diff --git a/server/protocol.c b/server/protocol.c index 8d35247508c..c4dc7b5763f 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"); }