Commit 80e850be authored by Marek Vavruša's avatar Marek Vavruša

lib/lru: args checking

parent f2e8ef0b
......@@ -110,6 +110,9 @@ struct { \
/** @internal Slot data getter */
static inline void *lru_slot_get(struct lru_hash_base *lru, const char *key, uint32_t len, size_t offset)
{
if (!lru || !key || len == 0) {
return NULL;
}
uint32_t id = hash(key, len) % lru->size;
struct lru_slot *slot = (struct lru_slot *)(lru->slots + (id * lru->stride));
if (lru_slot_match(slot, key, len)) {
......@@ -121,6 +124,9 @@ static inline void *lru_slot_get(struct lru_hash_base *lru, const char *key, uin
/** @internal Slot data setter */
static inline void *lru_slot_set(struct lru_hash_base *lru, const char *key, uint32_t len, size_t offset)
{
if (!lru || !key || len == 0) {
return NULL;
}
uint32_t id = hash(key, len) % lru->size;
struct lru_slot *slot = (struct lru_slot *)(lru->slots + (id * lru->stride));
if (!lru_slot_match(slot, key, len)) {
......
......@@ -253,8 +253,10 @@ int kr_zonecut_find_cached(struct kr_context *ctx, struct kr_zonecut *cut, const
}
/* Start at QNAME parent. */
name = knot_wire_next_label(name, NULL);
while (txn && name) {
if (name[0] != '\0') {
name = knot_wire_next_label(name, NULL);
}
while (txn) {
if (fetch_ns(ctx, cut, name, txn, timestamp) == 0) {
update_cut_name(cut, name);
return kr_ok();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment