diff options
| author | Felix Fietkau | 2025-03-19 12:17:08 +0000 |
|---|---|---|
| committer | Felix Fietkau | 2025-03-19 12:17:08 +0000 |
| commit | c0df580adbd4d555ecc1962dbe88e91d75b67a4e (patch) | |
| tree | 3c9ee64e314e7e084e96b3530aa7382c3d551a89 | |
| parent | 965c4bf49658342ced0bd6e7cb069571b4a1ddff (diff) | |
| download | libnl-tiny-c0df580adbd4d555ecc1962dbe88e91d75b67a4e.tar.gz | |
attr.c: fix nla_reserve size check
Signed-off-by: Felix Fietkau <nbd@nbd.name>
| -rw-r--r-- | attr.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -618,11 +618,11 @@ struct nlattr *nla_find(struct nlattr *head, int len, int attrtype) struct nlattr *nla_reserve(struct nl_msg *msg, int attrtype, int attrlen) { struct nlattr *nla; - int tlen; - + size_t tlen; + tlen = NLMSG_ALIGN(msg->nm_nlh->nlmsg_len) + nla_total_size(attrlen); - if ((tlen + msg->nm_nlh->nlmsg_len) > msg->nm_size) + if (tlen > msg->nm_size || tlen > UINT32_MAX) return NULL; nla = (struct nlattr *) nlmsg_tail(msg->nm_nlh); |