From: Joe Orton Date: Tue, 31 Jan 2017 08:23:38 +0000 (+0000) Subject: * modules/metadata/mod_remoteip.c: Fix GCC strict-aliasing warning X-Git-Tag: 2.5.0-alpha~722 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9930da25609aa9d0e99a9630c5d320a5546b68d4;p=thirdparty%2Fapache%2Fhttpd.git * modules/metadata/mod_remoteip.c: Fix GCC strict-aliasing warning by moving deference of header array via a different pointer type ("type-punning") out of line. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1781030 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/metadata/mod_remoteip.c b/modules/metadata/mod_remoteip.c index 4b3fef6134a..fa6963f06f1 100644 --- a/modules/metadata/mod_remoteip.c +++ b/modules/metadata/mod_remoteip.c @@ -989,6 +989,12 @@ static remoteip_parse_status_t remoteip_process_v2_header(conn_rec *c, return HDR_DONE; } +/** Return length for a v2 protocol header. */ +static apr_size_t remoteip_get_v2_len(proxy_header *hdr) +{ + return ntohs(hdr->v2.len); +} + /** Determine if this is a v1 or v2 PROXY header. */ static int remoteip_determine_version(conn_rec *c, const char *ptr) @@ -1112,7 +1118,8 @@ static apr_status_t remoteip_input_filter(ap_filter_t *f, else if (ctx->version == 2) { if (ctx->rcvd >= MIN_V2_HDR_LEN) { ctx->need = MIN_V2_HDR_LEN + - ntohs(((proxy_header *) ctx->header)->v2.len); + remoteip_get_v2_len((proxy_header *) ctx->header); + } if (ctx->rcvd >= ctx->need) { psts = remoteip_process_v2_header(f->c, conn_conf,