From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Arturo Borrero <arturo.borrero.glez@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [libnftables PATCH] data_reg: xml: fix invalid veredict validation
Date: Wed, 5 Jun 2013 05:43:27 +0200 [thread overview]
Message-ID: <20130605034327.GA31658@localhost> (raw)
In-Reply-To: <20130529224626.18127.15020.stgit@nfdev.cica.es>
On Thu, May 30, 2013 at 12:46:26AM +0200, Arturo Borrero wrote:
> Other kind of validations are used all over the XML parsing code.
> This validation is not valid anymore, and this patch update it.
>
> Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
> ---
> src/expr/data_reg.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/src/expr/data_reg.c b/src/expr/data_reg.c
> index 71b10fe..12adc18 100644
> --- a/src/expr/data_reg.c
> +++ b/src/expr/data_reg.c
> @@ -64,10 +64,8 @@ static int nft_data_reg_verdict_xml_parse(union nft_data_reg *reg, char *xml)
> return -1;
> }
>
> - errno = 0;
> tmp = strtoll(node->child->value.opaque, &endptr, 10);
> - if (tmp > INT_MAX || tmp < INT_MIN || errno != 0
> - || strlen(endptr) > 0) {
> + if (tmp > INT_MAX || tmp < INT_MIN || *endptr) {
I think it's time to add some helper function like nft_stroll. This
function will take care of this tricky error handling and it will just
return -1 in case of error. You can put this new function in
src/utils.c and define it protype in internal.h.
prev parent reply other threads:[~2013-06-05 3:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-29 22:46 [libnftables PATCH] data_reg: xml: fix invalid veredict validation Arturo Borrero
2013-06-05 3:43 ` Pablo Neira Ayuso [this message]
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=20130605034327.GA31658@localhost \
--to=pablo@netfilter.org \
--cc=arturo.borrero.glez@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/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.