You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2016/12/07 22:54:36 UTC

svn commit: r1773158 - /httpd/httpd/branches/2.4.x/server/protocol.c

Author: wrowe
Date: Wed Dec  7 22:54:36 2016
New Revision: 1773158

URL: http://svn.apache.org/viewvc?rev=1773158&view=rev
Log:
As noted by rpluem, r->protocol isn't const char *. Ensure the exit cases
are pstrdup'ed. Note that r->protocol = "" is not in a return path.

Simplify the garbage-in protocol handling without consideration to 'strict'
settings. It is expected to be caused by an invalid raw SP in the URL.

Submitted by: rpluem, wrowe

Modified:
    httpd/httpd/branches/2.4.x/server/protocol.c

Modified: httpd/httpd/branches/2.4.x/server/protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/protocol.c?rev=1773158&r1=1773157&r2=1773158&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/protocol.c (original)
+++ httpd/httpd/branches/2.4.x/server/protocol.c Wed Dec  7 22:54:36 2016
@@ -782,18 +782,15 @@ rrl_done:
             memcpy((char*)r->protocol, "HTTP", 4);
     }
     else if (r->protocol[0]) {
-        r->assbackwards = 0;
-        r->proto_num = HTTP_VERSION(1,0);
         /* Defer setting the r->protocol string till error msg is composed */
-        if (strict && deferred_error == rrl_none)
+        r->proto_num = HTTP_VERSION(0,9);
+        if (deferred_error == rrl_none)
             deferred_error = rrl_badprotocol;
-        else
-            r->protocol  = "HTTP/1.0";
     }
     else {
         r->assbackwards = 1;
-        r->protocol = "HTTP/0.9";
         r->proto_num = HTTP_VERSION(0, 9);
+        r->protocol  = apr_pstrdup(r->pool, "HTTP/0.9");
     }
 
     /* Determine the method_number and parse the uri prior to invoking error
@@ -906,7 +903,7 @@ rrl_failed:
         r->assbackwards = 0;
         r->connection->keepalive = AP_CONN_CLOSE;
         r->proto_num = HTTP_VERSION(1, 0);
-        r->protocol  = "HTTP/1.0";
+        r->protocol  = apr_pstrdup(r->pool, "HTTP/1.0");
     }
     return 0;
 }