diff --git a/usr.sbin/bootp/common/readfile.c b/usr.sbin/bootp/common/readfile.c index 6c4576cc84a5..1cfa81dcad31 100644 --- a/usr.sbin/bootp/common/readfile.c +++ b/usr.sbin/bootp/common/readfile.c @@ -22,7 +22,7 @@ SOFTWARE. #include #ifndef lint -__RCSID("$NetBSD: readfile.c,v 1.19 2011/10/07 10:06:39 joerg Exp $"); +__RCSID("$NetBSD: readfile.c,v 1.20 2017/01/11 12:18:22 joerg Exp $"); #endif @@ -1582,23 +1582,21 @@ makelower(char *s) PRIVATE struct in_addr_list * get_addresses(char **src) { - struct in_addr tmpaddrlist[MAXINADDRS]; - struct in_addr *address1, *address2; + __aligned(4) struct in_addr tmpaddrlist[MAXINADDRS]; struct in_addr_list *result; - unsigned addrcount, totalsize; + unsigned addrcount, totalsize, address; - address1 = tmpaddrlist; - for (addrcount = 0; addrcount < MAXINADDRS; addrcount++) { + for (address = 0, addrcount = 0; addrcount < MAXINADDRS; addrcount++) { while (isspace((unsigned char)**src) || (**src == ',')) { (*src)++; } if (!**src) { /* Quit if nothing more */ break; } - if (prs_inetaddr(src, &(address1->s_addr)) < 0) { + if (prs_inetaddr(src, &tmpaddrlist[address].s_addr) < 0) { break; } - address1++; /* Point to next address slot */ + address++; /* Point to next address slot */ } if (addrcount < 1) { result = NULL; @@ -1608,13 +1606,8 @@ get_addresses(char **src) result = (struct in_addr_list *) smalloc(totalsize); result->linkcount = 1; result->addrcount = addrcount; - address1 = tmpaddrlist; - address2 = result->addr; - for (; addrcount > 0; addrcount--) { - address2->s_addr = address1->s_addr; - address1++; - address2++; - } + for (address = 0; address < addrcount; ++address) + result->addr[address] = tmpaddrlist[address]; } return result; }