From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Rick Xu <rickxbx@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: Something like a bug
Date: Tue, 15 Apr 2008 17:47:19 +0200 [thread overview]
Message-ID: <4804CE07.3060507@netfilter.org> (raw)
In-Reply-To: <dbdd0cc00804140027y54a00ca7pdef3b091dde33bf6@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]
Rick Xu wrote:
> int nfnl_nfa_addattr_l(struct nfattr *nfa, int maxlen, int type,
> const void *data, int alen)
> {
> ......
>
> if ((NFA_OK(nfa, nfa->nfa_len) + len) > maxlen) {
> errno = ENOSPC;
> return -1;
> }
>
> subnfa = (struct nfattr *)(((char *)nfa) + NFA_OK(nfa, nfa->nfa_len));
>
> .....
> }
>
> NFA_OK looks so weird here. I think it should be:
> int nfnl_nfa_addattr_l(struct nfattr *nfa, int maxlen, int type,
> const void *data, int alen)
> {
> ......
>
> if ( NFA_ALIGN(nfa->nfa_len) + NFA_LENGTH(len) > maxlen) {
> errno = ENOSPC;
> return -1;
> }
>
> subnfa = (struct nfattr *)(((char *)nfa) + NFA_ALIGN( nfa->nfa_len));
>
> .....
> }
>
> Please kindly correct me if I made a mistake.
Indeed, that function is completely broken but it does not have any
known client.
It seems a leftover of the days when we didn't have anything better to
nest attributes, so that it's completely useless these days. I have
fixed in SVN anyway. Patch attached.
--
"Los honestos son inadaptados sociales" -- Les Luthiers
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1039 bytes --]
Index: configure.in
===================================================================
--- configure.in (revisión: 7400)
+++ configure.in (copia de trabajo)
@@ -4,7 +4,7 @@
AC_CANONICAL_SYSTEM
-AM_INIT_AUTOMAKE(libnfnetlink, 0.0.33)
+AM_INIT_AUTOMAKE(libnfnetlink, 0.0.34)
AC_PROG_CC
AC_EXEEXT
Index: src/libnfnetlink.c
===================================================================
--- src/libnfnetlink.c (revisión: 7400)
+++ src/libnfnetlink.c (copia de trabajo)
@@ -799,16 +799,16 @@
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;
}
next prev parent reply other threads:[~2008-04-15 15:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-14 7:27 Something like a bug Rick Xu
2008-04-15 15:47 ` Pablo Neira Ayuso [this message]
2008-04-15 16:00 ` Rick Xu
2008-04-15 17:21 ` Jan Engelhardt
2008-04-16 13:47 ` Pablo Neira Ayuso
2008-04-16 14:48 ` Jan Engelhardt
2008-04-16 15:00 ` remove deprecated use of AC_INIT_AUTOMAKE [was Re: Something like a bug] Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4804CE07.3060507@netfilter.org \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=rickxbx@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.