]> git.decadent.org.uk Git - odhcp6c.git/commitdiff
Fix odhcp6c_find_entry
authorSteven Barth <steven@midlink.org>
Sun, 12 Apr 2015 12:02:59 +0000 (14:02 +0200)
committerSteven Barth <steven@midlink.org>
Sun, 12 Apr 2015 12:02:59 +0000 (14:02 +0200)
Signed-off-by: Steven Barth <steven@midlink.org>
src/odhcp6c.c
src/odhcp6c.h

index 2d828566ed75be0ddb0eb27b7e169a764754e65a..4c534c17b518a66d74688f9131123b2351c9ecc9 100644 (file)
@@ -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;
 
index f7ddc968a93f7eb0288c10040f1761ee77d18b4a..104213681c8b18001bf5a131ceb98c9a12c61c26 100644 (file)
@@ -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);