]> granicus.if.org Git - apache/commitdiff
* modules/metadata/mod_remoteip.c: Fix GCC strict-aliasing warning
authorJoe Orton <jorton@apache.org>
Tue, 31 Jan 2017 08:23:38 +0000 (08:23 +0000)
committerJoe Orton <jorton@apache.org>
Tue, 31 Jan 2017 08:23:38 +0000 (08:23 +0000)
  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

modules/metadata/mod_remoteip.c

index 4b3fef6134a86d55f7a2eb7b08730ce1a546ac67..fa6963f06f14c71b4cac764df8ed45b7562e695f 100644 (file)
@@ -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,