From: Ezra Peisach Date: Sun, 25 Jan 2009 16:44:02 +0000 (+0000) Subject: Use a struct in_addr to insure alignment of address - instead of X-Git-Tag: krb5-1.7-alpha1~37 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b3a5ec5c59e2c854a9372e0b44bc50db4d755b84;p=krb5.git Use a struct in_addr to insure alignment of address - instead of random alignment on the stack. Solaris 2.10 has issues if the address is not aligned. The rest of the code in the tree uses a struct in_addr or mallocs the address - which will be sufficiently aligned. ticket: 6308 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21794 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/tests/resolve/resolve.c b/src/tests/resolve/resolve.c index 62768af26..47fd6bd06 100644 --- a/src/tests/resolve/resolve.c +++ b/src/tests/resolve/resolve.c @@ -78,7 +78,7 @@ main(argc, argv) { char myname[MAXHOSTNAMELEN+1]; char *ptr; - char addrcopy[4]; + struct in_addr addrcopy; struct hostent *host; int quiet = 0; @@ -124,10 +124,10 @@ main(argc, argv) printf("Host address: %d.%d.%d.%d\n", UC(ptr[0]), UC(ptr[1]), UC(ptr[2]), UC(ptr[3])); - memcpy(addrcopy, ptr, 4); + memcpy(&addrcopy.s_addr, ptr, 4); /* Convert back to full name */ - if((host = gethostbyaddr(addrcopy, 4, AF_INET)) == NULL) { + if((host = gethostbyaddr(&addrcopy.s_addr, 4, AF_INET)) == NULL) { fprintf(stderr, "Error looking up IP address - fatal\n"); exit(2); }