struct param_ctx ctx = {};
struct nlmsghdr *nlh;
bool conv_exists;
- uint32_t val_u32;
+ uint32_t val_u32 = 0;
uint16_t val_u16;
uint8_t val_u8;
bool val_bool;
void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len)
{
- char eaddr[32];
+ char eaddr[18];
ether_ntoa_r((const struct ether_addr *)id->addr, eaddr);
snprintf(buf, len, "%.2x%.2x.%s", id->prio[0], id->prio[1], eaddr);
buf[strlen(buf)-1] = 0;
if (info_source[0] && strcmp(info_source, buf+1))
source_mismatch = 1;
- strncpy(info_source, buf+1, sizeof(info_source)-1);
+ strlcpy(info_source, buf+1, sizeof(info_source));
continue;
}
if ((n = malloc(sizeof(*n))) == NULL)
buf[strlen(buf)-1] = 0;
if (info_source[0] && strcmp(info_source, buf+1))
source_mismatch = 1;
- info_source[0] = 0;
- strncat(info_source, buf+1, sizeof(info_source)-1);
+ strlcpy(info_source, buf + 1, sizeof(info_source));
continue;
}
/* idbuf is as big as buf, so this is safe */
}
NEXT_ARG();
}
- hash = sel2.sel.keys[0].val & sel2.sel.keys[0].mask;
+ hash = sel2.keys[0].val & sel2.keys[0].mask;
hash ^= hash >> 16;
hash ^= hash >> 8;
htid = ((hash % divisor) << 12) | (htid & 0xFFF00000);
/* Shift the field by 4 bits on success. */
if (!res) {
int nkeys = sel->sel.nkeys;
- struct tc_pedit_key *key = &sel->sel.keys[nkeys - 1];
+ struct tc_pedit_key *key = &sel->keys[nkeys - 1];
key->mask = htonl(ntohl(key->mask) << 4 | 0xf);
key->val = htonl(ntohl(key->val) << 4);