From 8a8005f7ca8973702b36e711993bfff89ca9600c Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 28 Jan 2016 04:33:48 +0000 Subject: Add padding between odhcp6c_entry structures to ensure 32-bit alignment struct odhcp6c_entry is not declared as __packed, so the compiler may assume it is naturally aligned. Signed-off-by: Ben Hutchings --- src/script.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/script.c') diff --git a/src/script.c b/src/script.c index 1533510..72add21 100644 --- a/src/script.c +++ b/src/script.c @@ -220,8 +220,9 @@ static void search_to_env(const char *name, const uint8_t *start, size_t len) *c++ = '='; for (struct odhcp6c_entry *e = (struct odhcp6c_entry*)start; - (uint8_t*)e < &start[len] && &e->auxtarget[e->auxlen] <= &start[len]; - e = (struct odhcp6c_entry*)(&e->auxtarget[e->auxlen])) { + (uint8_t*)e < &start[len] && + (uint8_t*)odhcp6c_next_entry(e) <= &start[len]; + e = odhcp6c_next_entry(e)) { c = mempcpy(c, e->auxtarget, e->auxlen); *c++ = ' '; } -- cgit v1.2.1