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 13:09:07 UTC

svn commit: r1893030 - in /httpd/httpd/trunk: changes-entries/init_request_on_read_failure.txt server/protocol.c

Author: ylavic
Date: Tue Sep  7 13:09:07 2021
New Revision: 1893030

URL: http://svn.apache.org/viewvc?rev=1893030&view=rev
Log:
core: Initialize the request fields on read failure to avoid NULLs.

* server/protocol.c(read_request_line):
  Set r->method_number to M_INVALID and r->{method,uri,unparsed_uri} to "-"
  when read fails, ap_parse_request_line() will never be called.


Added:
    httpd/httpd/trunk/changes-entries/init_request_on_read_failure.txt
      - copied unchanged from r1893027, httpd/httpd/trunk/changes-entries/init_request_on_read_failure.txt
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=1893030&r1=1893029&r2=1893030&view=diff
==============================================================================
--- httpd/httpd/trunk/server/protocol.c (original)
+++ httpd/httpd/trunk/server/protocol.c Tue Sep  7 13:09:07 2021
@@ -716,6 +716,11 @@ static int read_request_line(request_rec
         if (rv != APR_SUCCESS) {
             r->request_time = apr_time_now();
 
+            /* Fall through with an invalid (non NULL) request */
+            r->method = "-";
+            r->method_number = M_INVALID;
+            r->uri = r->unparsed_uri = apr_pstrdup(r->pool, "-");
+
             /* ap_rgetline returns APR_ENOSPC if it fills up the
              * buffer before finding the end-of-line.  This is only going to
              * happen if it exceeds the configured limit for a request-line.