From 5b247e7c2f91ee9fb2cec171fdd9582c06b654fe Mon Sep 17 00:00:00 2001 From: "/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org" Date: Tue, 15 Apr 2008 15:54:15 +0000 Subject: fix nfnl_nfa_addattr_l (reported by Rick Xu) --- configure.in | 2 +- src/libnfnetlink.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.in b/configure.in index 6a71da3..feb3672 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ AC_INIT AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(libnfnetlink, 0.0.33) +AM_INIT_AUTOMAKE(libnfnetlink, 0.0.34) AC_PROG_CC AC_EXEEXT diff --git a/src/libnfnetlink.c b/src/libnfnetlink.c index 6b91631..58d989f 100644 --- a/src/libnfnetlink.c +++ b/src/libnfnetlink.c @@ -799,16 +799,16 @@ int nfnl_nfa_addattr_l(struct nfattr *nfa, int maxlen, int type, assert(maxlen > 0); assert(type >= 0); - if ((NFA_OK(nfa, nfa->nfa_len) + len) > maxlen) { + if (NFA_ALIGN(nfa->nfa_len) + len > maxlen) { errno = ENOSPC; return -1; } - subnfa = (struct nfattr *)(((char *)nfa) + NFA_OK(nfa, nfa->nfa_len)); + subnfa = (struct nfattr *)(((char *)nfa) + NFA_ALIGN(nfa->nfa_len)); subnfa->nfa_type = type; subnfa->nfa_len = len; memcpy(NFA_DATA(subnfa), data, alen); - nfa->nfa_len = (NLMSG_ALIGN(nfa->nfa_len) + len); + nfa->nfa_len = NFA_ALIGN(nfa->nfa_len) + len; return 0; } -- cgit v1.2.3