diff options
Diffstat (limited to 'lib/attr.c')
-rw-r--r-- | lib/attr.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -481,9 +481,8 @@ struct nlattr *nla_reserve(struct nl_msg *n, int attrtype, int attrlen) tlen = NLMSG_ALIGN(n->nm_nlh->nlmsg_len) + nla_total_size(attrlen); - n->nm_nlh = realloc(n->nm_nlh, tlen); - if (!n->nm_nlh) { - nl_errno(ENOMEM); + if ((tlen + n->nm_nlh->nlmsg_len) > n->nm_size) { + nl_errno(ENOBUFS); return NULL; } |