diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2016-12-07 23:18:05 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2016-12-07 23:18:05 +0000 |
commit | 1919019671390c0c29ecf524d35bcc90b2342ddb (patch) | |
tree | 2d0faffc0c5371d406d0671d927681de73b74ddc | |
parent | a265da6f65af37cbf8efec3685cc2e935795f759 (diff) | |
download | httpd-1919019671390c0c29ecf524d35bcc90b2342ddb.tar.gz |
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.
Backports: r1773159 (with pstrdup enhancement)
Submitted by: rpluem, wrowe
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x-merge-http-strict@1773161 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | server/protocol.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/server/protocol.c b/server/protocol.c index 7bc292cb16..63b358d483 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -782,17 +782,14 @@ rrl_done: memcpy((char*)r->protocol, "HTTP", 4); } else if (r->protocol[0]) { - r->assbackwards = 0; - r->proto_num = HTTP_VERSION(1,0); + r->proto_num = HTTP_VERSION(0, 9); /* Defer setting the r->protocol string till error msg is composed */ - if (strict && deferred_error == rrl_none) + 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->protocol = apr_pstrdup(r->pool, "HTTP/0.9"); r->proto_num = HTTP_VERSION(0, 9); } @@ -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; } |