All of lore.kernel.org
 help / color / mirror / Atom feed
* [nft PATCH v2] evaluate: reject: fix crash on NULL location with bridge and tcp reset
@ 2014-11-26 11:07 Alvaro Neira Ayuso
  2014-11-26 11:13 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Alvaro Neira Ayuso @ 2014-11-26 11:07 UTC (permalink / raw)
  To: netfilter-devel; +Cc: kaber

If we use tcp reset with a network protocol that tcp is not supported,
we display an error. This error use the reject.expr location which is NULL,
therefore we have a crash. This patch replaces it using the reject statement
to display the error like:

Rule:
 nft add bridge filter input ether type vlan reject with tcp reset
Output:
 <cmdline>:1:46-51: Error: cannot reject this ether type
 add rule bridge filter input ether type vlan reject with tcp reset
                              ~~~~~~~~~~~~~~~ ^^^^^^

Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
---
[changes in v2]
* Enhanced title and description

 src/evaluate.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/evaluate.c b/src/evaluate.c
index 3eeb614..00e55b7 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -1277,7 +1277,7 @@ static int stmt_evaluate_reject_bridge_family(struct eval_ctx *ctx,
 		case __constant_htons(ETH_P_IPV6):
 			break;
 		default:
-			return stmt_binary_error(ctx, stmt->reject.expr,
+			return stmt_binary_error(ctx, stmt,
 				    &ctx->pctx.protocol[PROTO_BASE_NETWORK_HDR],
 				    "cannot reject this ether type");
 		}
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [nft PATCH v2] evaluate: reject: fix crash on NULL location with bridge and tcp reset
  2014-11-26 11:07 [nft PATCH v2] evaluate: reject: fix crash on NULL location with bridge and tcp reset Alvaro Neira Ayuso
@ 2014-11-26 11:13 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2014-11-26 11:13 UTC (permalink / raw)
  To: Alvaro Neira Ayuso; +Cc: netfilter-devel, kaber

On Wed, Nov 26, 2014 at 12:07:51PM +0100, Alvaro Neira Ayuso wrote:
> If we use tcp reset with a network protocol that tcp is not supported,
> we display an error. This error use the reject.expr location which is NULL,
> therefore we have a crash. This patch replaces it using the reject statement
> to display the error like:
> 
> Rule:
>  nft add bridge filter input ether type vlan reject with tcp reset
> Output:
>  <cmdline>:1:46-51: Error: cannot reject this ether type
>  add rule bridge filter input ether type vlan reject with tcp reset

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-26 11:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-26 11:07 [nft PATCH v2] evaluate: reject: fix crash on NULL location with bridge and tcp reset Alvaro Neira Ayuso
2014-11-26 11:13 ` Pablo Neira Ayuso

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.