From: Steven Barth Date: Wed, 15 Apr 2015 12:55:57 +0000 (+0200) Subject: ra: avoid saving an empty search domain entry X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cc1ecd2c994d5cdf31b8184d87f8849b20b0c37c;p=oweals%2Fodhcp6c.git ra: avoid saving an empty search domain entry Signed-off-by: Steven Barth --- diff --git a/src/ra.c b/src/ra.c index dcb3e0f..1c121e6 100644 --- a/src/ra.c +++ b/src/ra.c @@ -424,14 +424,17 @@ bool ra_process(void) while (buf < end) { int len = dn_expand(buf, end, buf, (char*)entry->auxtarget, 256); - if (len > 0) { - buf = &buf[len]; - entry->auxlen = strlen((char*)entry->auxtarget); - changed |= odhcp6c_update_entry(STATE_RA_SEARCH, entry, 0, true); - entry->auxlen = 0; - } else { + if (len < 1) break; - } + + buf = &buf[len]; + entry->auxlen = strlen((char*)entry->auxtarget); + + if (entry->auxlen == 0) + continue; + + changed |= odhcp6c_update_entry(STATE_RA_SEARCH, entry, 0, true); + entry->auxlen = 0; } } }