1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 01:27:11 +03:00

sd-rtnl: message parsing - log when ignoring message attributes

This commit is contained in:
Tom Gundersen 2014-03-24 11:58:22 +01:00
parent d39edfc72f
commit e634cd4096

View File

@ -1040,7 +1040,7 @@ int rtnl_message_parse(sd_rtnl_message *m,
int max, int max,
struct rtattr *rta, struct rtattr *rta,
unsigned int rt_len) { unsigned int rt_len) {
int type; unsigned short type;
size_t *tb; size_t *tb;
tb = (size_t *) new0(size_t *, max); tb = (size_t *) new0(size_t *, max);
@ -1052,7 +1052,14 @@ int rtnl_message_parse(sd_rtnl_message *m,
for (; RTA_OK(rta, rt_len); rta = RTA_NEXT(rta, rt_len)) { for (; RTA_OK(rta, rt_len); rta = RTA_NEXT(rta, rt_len)) {
type = rta->rta_type; type = rta->rta_type;
if (type <= max) if (type > max) {
log_debug("rtnl: message parse - ignore out of range attribute type");
continue;
}
if (tb[type])
log_debug("rtnl: message parse - overwriting repeated attribute");
tb[type] = (uint8_t *) rta - (uint8_t *) m->hdr; tb[type] = (uint8_t *) rta - (uint8_t *) m->hdr;
} }