changeset 10587:98ee4f22da6e v8.0.0183

patch 8.0.0183: ubsan warns for unaligned address commit https://github.com/vim/vim/commit/7173b47958a238bb07f80b8f26fb232b0ea69b4a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 14 17:04:38 2017 +0100 patch 8.0.0183: ubsan warns for unaligned address Problem: Ubsan warns for using a pointer that is not aligned. Solution: First copy the address. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Sat, 14 Jan 2017 17:15:04 +0100
parents e90e0288851a
children bf381219fbb5
files src/channel.c src/version.c
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -710,7 +710,14 @@ channel_open(
 	channel_free(channel);
 	return NULL;
     }
-    memcpy((char *)&server.sin_addr, host->h_addr, host->h_length);
+    {
+	char		*p;
+
+	/* When using host->h_addr directly ubsan warns for it to not be
+	 * aligned.  First copy the pointer to aviod that. */
+	memcpy(&p, &host->h_addr, sizeof(p));
+	memcpy((char *)&server.sin_addr, p, host->h_length);
+    }
 
     /* On Mac and Solaris a zero timeout almost never works.  At least wait
      * one millisecond. Let's do it for all systems, because we don't know why
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    183,
+/**/
     182,
 /**/
     181,