From: William A. Rowe Jr Date: Wed, 3 Aug 2016 21:18:12 +0000 (+0000) Subject: Testing len > 0 is redundant when *field is a "\0" and mismatches here. X-Git-Tag: 2.5.0-alpha~1338 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5f7565364faaddc8100aa6eab8de17751cf6f711;p=thirdparty%2Fapache%2Fhttpd.git Testing len > 0 is redundant when *field is a "\0" and mismatches here. folded flag was a no-op, unused once we added continue; logic. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1755114 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/protocol.c b/server/protocol.c index 957b8be618b..443416f8ae3 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -790,7 +790,6 @@ AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r, apr_bucket_brigade *bb */ while(1) { apr_status_t rv; - int folded = 0; field = NULL; rv = ap_rgetline(&field, r->server->limit_req_fieldsize + 2, @@ -835,7 +834,8 @@ AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r, apr_bucket_brigade *bb return; } - if ((len > 0) && ((*field == '\t') || *field == ' ')) { + /* Process an obs-fold immediately by appending it to last_field */ + if ((*field == '\t') || *field == ' ') { if (last_field == NULL) { r->status = HTTP_BAD_REQUEST; @@ -891,7 +891,6 @@ AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r, apr_bucket_brigade *bb last_field[last_len] = ' '; } last_len += len; - folded = 1; continue; } @@ -1024,10 +1023,8 @@ AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r, apr_bucket_brigade *bb * the next loop iteration. (In the folded case, last_field * has been updated already.) */ - if (!folded) { - last_field = field; - last_len = len; - } + last_field = field; + last_len = len; } /* Combine multiple message-header fields with the same