continue;
}
- struct dseckey *key;
+ struct dseckey *key = NULL;
if (kr_dnssec_key_from_rdata(&key, keys->owner, key_data, knot_rdata_rdlen(krr)) != 0) {
continue;
}
while (ptr[0]) {
/* Remove leftmost label and replace it with '\1*'. */
ptr = (uint8_t *) knot_wire_next_label(ptr, NULL);
+ if (!ptr) {
+ return kr_error(EINVAL);
+ }
*(--ptr) = '*';
*(--ptr) = 1;
/* True if this wildcard provably doesn't exist. */
for (int j = 0; j < trim_labels; ++j) {
assert(beginp[0]);
beginp = (uint8_t *) knot_wire_next_label(beginp, NULL);
+ assert(beginp != NULL);
}
*(--beginp) = '*';
*(--beginp) = 1;
EXPORT int map_walk_prefixed(map_t *map, const char *prefix,
int (*callback)(const char *, void *, void *), void *baton)
{
+ if (!map) {
+ return 0;
+ }
+
const uint8_t *ubytes = (void *)prefix;
const size_t ulen = strlen(prefix);
uint8_t *p = map->root;
- uint8_t *top = (uint8_t *)p;
+ uint8_t *top = p;
cb_data_t *data = NULL;
if (p == NULL) {
}
}
+ /* At least two addresses must be in the address list */
+ assert(count > 0);
ns->score = scores[0];
ns->reputation = 0;
return kr_ok();
} while (state == KR_STATE_CONSUME);
/* Update minimized QNAME if zone cut changed */
- if (qry->zone_cut.name[0] != '\0' && !(qry->flags.NO_MINIMIZE)) {
+ if (qry->zone_cut.name && qry->zone_cut.name[0] != '\0' && !(qry->flags.NO_MINIMIZE)) {
if (kr_make_query(qry, packet) != 0) {
return KR_STATE_FAIL;
}
char* kr_strcatdup(unsigned n, ...)
{
+ if (n < 1) {
+ return NULL;
+ }
+
/* Calculate total length */
size_t total_len = 0;
va_list vl;
if (subnet) {
*subnet = '\0';
subnet += 1;
- bit_len = atoi(subnet);
+ bit_len = strtol(subnet, NULL, 10);
/* Check client subnet length */
const int max_len = (family == AF_INET6) ? 128 : 32;
if (bit_len < 0 || bit_len > max_len) {