parent
56eb94cca6
commit
3dabdbb3da
|
|
@ -491,7 +491,7 @@ int addattr_l(struct nlmsghdr *n, int maxlen, int type, const void *data,
|
||||||
int len = RTA_LENGTH(alen);
|
int len = RTA_LENGTH(alen);
|
||||||
struct rtattr *rta;
|
struct rtattr *rta;
|
||||||
|
|
||||||
if (NLMSG_ALIGN(n->nlmsg_len) + len > maxlen) {
|
if (NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len) > maxlen) {
|
||||||
fprintf(stderr, "addattr_l ERROR: message exceeded bound of %d\n",maxlen);
|
fprintf(stderr, "addattr_l ERROR: message exceeded bound of %d\n",maxlen);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -499,7 +499,7 @@ int addattr_l(struct nlmsghdr *n, int maxlen, int type, const void *data,
|
||||||
rta->rta_type = type;
|
rta->rta_type = type;
|
||||||
rta->rta_len = len;
|
rta->rta_len = len;
|
||||||
memcpy(RTA_DATA(rta), data, alen);
|
memcpy(RTA_DATA(rta), data, alen);
|
||||||
n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + len;
|
n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -539,7 +539,7 @@ int rta_addattr_l(struct rtattr *rta, int maxlen, int type,
|
||||||
struct rtattr *subrta;
|
struct rtattr *subrta;
|
||||||
int len = RTA_LENGTH(alen);
|
int len = RTA_LENGTH(alen);
|
||||||
|
|
||||||
if (RTA_ALIGN(rta->rta_len) + len > maxlen) {
|
if (RTA_ALIGN(rta->rta_len) + RTA_ALIGN(len) > maxlen) {
|
||||||
fprintf(stderr,"rta_addattr_l: Error! max allowed bound %d exceeded\n",maxlen);
|
fprintf(stderr,"rta_addattr_l: Error! max allowed bound %d exceeded\n",maxlen);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -547,7 +547,7 @@ int rta_addattr_l(struct rtattr *rta, int maxlen, int type,
|
||||||
subrta->rta_type = type;
|
subrta->rta_type = type;
|
||||||
subrta->rta_len = len;
|
subrta->rta_len = len;
|
||||||
memcpy(RTA_DATA(subrta), data, alen);
|
memcpy(RTA_DATA(subrta), data, alen);
|
||||||
rta->rta_len = NLMSG_ALIGN(rta->rta_len) + len;
|
rta->rta_len = NLMSG_ALIGN(rta->rta_len) + RTA_ALIGN(len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue