From: Steven Barth Date: Sun, 12 Apr 2015 12:02:59 +0000 (+0200) Subject: Fix odhcp6c_find_entry X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e1540ec55e014e538a92a588675e4156a1bddabe;p=oweals%2Fodhcp6c.git Fix odhcp6c_find_entry Signed-off-by: Steven Barth --- diff --git a/src/odhcp6c.c b/src/odhcp6c.c index 2d82856..4c534c1 100644 --- a/src/odhcp6c.c +++ b/src/odhcp6c.c @@ -553,9 +553,9 @@ void* odhcp6c_get_state(enum odhcp6c_state state, size_t *len) } -struct odhcp6c_entry* odhcp6c_find_entry(enum odhcp6c_state state, const struct odhcp6c_entry *new) +static struct odhcp6c_entry* odhcp6c_find_entry(enum odhcp6c_state state, const struct odhcp6c_entry *new) { - size_t len, cmplen = offsetof(struct odhcp6c_entry, target) + new->length / 8; + size_t len, cmplen = offsetof(struct odhcp6c_entry, target) + ((new->length + 7) / 8); struct odhcp6c_entry *start = odhcp6c_get_state(state, &len); struct odhcp6c_entry *x = NULL; diff --git a/src/odhcp6c.h b/src/odhcp6c.h index f7ddc96..1042136 100644 --- a/src/odhcp6c.h +++ b/src/odhcp6c.h @@ -338,7 +338,6 @@ void* odhcp6c_move_state(enum odhcp6c_state state, size_t *len); void* odhcp6c_get_state(enum odhcp6c_state state, size_t *len); // Entry manipulation -struct odhcp6c_entry* odhcp6c_find_entry(enum odhcp6c_state state, const struct odhcp6c_entry *new); bool odhcp6c_update_entry(enum odhcp6c_state state, struct odhcp6c_entry *new, uint32_t safe, bool filterexcess); void odhcp6c_expire(void);