summaryrefslogtreecommitdiff
path: root/src/script.c
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2016-01-28 04:33:48 +0000
committerBen Hutchings <ben@decadent.org.uk>2016-01-28 15:46:56 +0000
commit8a8005f7ca8973702b36e711993bfff89ca9600c (patch)
tree35a11ed04a3a47a382dffcbdebb63d6d2ff74a17 /src/script.c
parentd277ddb78abd034eb0e1c088ac969cdeef10d9e2 (diff)
downloadodhcp6c-8a8005f7ca8973702b36e711993bfff89ca9600c.tar.gz
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 <ben@decadent.org.uk>
Diffstat (limited to 'src/script.c')
-rw-r--r--src/script.c5
1 files changed, 3 insertions, 2 deletions
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++ = ' ';
}