[evolution-patches] alignment patch, take 3
- From: Jeffrey Stedfast <fejj ximian com>
- To: evolution-patches ximian com
- Subject: [evolution-patches] alignment patch, take 3
- Date: 23 Apr 2003 15:38:57 -0400
hopefully the third time's a charm rule applies here too
Jeff
--
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com - www.ximian.com
? 41362.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.382
diff -u -r1.382 ChangeLog
--- ChangeLog 22 Apr 2003 16:00:38 -0000 1.382
+++ ChangeLog 23 Apr 2003 19:19:50 -0000
@@ -1,3 +1,9 @@
+2003-04-17 Jeffrey Stedfast <fejj ximian com>
+
+ * e-host-utils.c (e_gethostbyname_r): Keep our buf ptr aligned to
+ sizeof (char *). Should fix bug #41362.
+ (e_gethostbyaddr_r): Same.
+
2003-04-18 Anna Marie Dirks <anna ximian com>
* e-request.c (e_request_string): Added appropriate spacing/padding
Index: e-host-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-host-utils.c,v
retrieving revision 1.12
diff -u -r1.12 e-host-utils.c
--- e-host-utils.c 9 Apr 2003 18:41:17 -0000 1.12
+++ e-host-utils.c 23 Apr 2003 19:19:50 -0000
@@ -43,6 +43,8 @@
#endif
+#define ALIGN(x) (((x) + (sizeof (char *) - 1)) & ~(sizeof (char *) - 1))
+
#define GETHOST_PROCESS(h, host, buf, buflen, herr) G_STMT_START { \
int num_aliases = 0, num_addrs = 0; \
int req_length; \
@@ -153,6 +155,7 @@
break;
}
}
+
#endif /* ENABLE_IPv6 */
/**
@@ -189,8 +192,8 @@
return -1;
}
- len = strlen (res->ai_canonname);
- if (buflen < IPv6_BUFLEN_MIN + len + 1 + res->ai_addrlen)
+ len = ALIGN (strlen (res->ai_canonname) + 1);
+ if (buflen < IPv6_BUFLEN_MIN + len + res->ai_addrlen + sizeof (char *))
return ERANGE;
/* h_name */
@@ -217,7 +220,7 @@
memcpy (buf, addr, host->h_length);
addr = buf;
- buf += host->h_length;
+ buf += ALIGN (host->h_length);
/* h_addr_list */
((char **) buf)[0] = addr;
@@ -309,8 +312,8 @@
return -1;
}
- len = strlen (res->ai_canonname);
- if (buflen < IPv6_BUFLEN_MIN + len + 1 + res->ai_addrlen)
+ len = ALIGN (strlen (res->ai_canonname) + 1);
+ if (buflen < IPv6_BUFLEN_MIN + len + res->ai_addrlen + sizeof (char *))
return ERANGE;
/* h_name */
@@ -337,7 +340,7 @@
memcpy (buf, addr, host->h_length);
addr = buf;
- buf += host->h_length;
+ buf += ALIGN (host->h_length);
/* h_addr_list */
((char **) buf)[0] = addr;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]