All of lore.kernel.org
 help / color / mirror / Atom feed
* [nft PATCH] tproxy: Add missing error checking when parsing from netlink
@ 2019-10-21 14:40 Phil Sutter
  2019-10-21 15:59 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2019-10-21 14:40 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel, Máté Eckl

netlink_get_register() may return NULL and every other caller checks
that. Assuming this situation is not expected, just jump to 'err' label
without queueing an explicit error message.

Fixes: 2be1d52644cf7 ("src: Add tproxy support")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/netlink_delinearize.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
index f7d328a836998..154353b8161a0 100644
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
@@ -1041,6 +1041,8 @@ static void netlink_parse_tproxy(struct netlink_parse_ctx *ctx,
 	reg = netlink_parse_register(nle, NFTNL_EXPR_TPROXY_REG_ADDR);
 	if (reg) {
 		addr = netlink_get_register(ctx, loc, reg);
+		if (addr == NULL)
+			goto err;
 
 		switch (stmt->tproxy.family) {
 		case NFPROTO_IPV4:
@@ -1060,6 +1062,8 @@ static void netlink_parse_tproxy(struct netlink_parse_ctx *ctx,
 	reg = netlink_parse_register(nle, NFTNL_EXPR_TPROXY_REG_PORT);
 	if (reg) {
 		port = netlink_get_register(ctx, loc, reg);
+		if (port == NULL)
+			goto err;
 		expr_set_type(port, &inet_service_type, BYTEORDER_BIG_ENDIAN);
 		stmt->tproxy.port = port;
 	}
-- 
2.23.0


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

* Re: [nft PATCH] tproxy: Add missing error checking when parsing from netlink
  2019-10-21 14:40 [nft PATCH] tproxy: Add missing error checking when parsing from netlink Phil Sutter
@ 2019-10-21 15:59 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2019-10-21 15:59 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netfilter-devel, Máté Eckl

On Mon, Oct 21, 2019 at 04:40:03PM +0200, Phil Sutter wrote:
> netlink_get_register() may return NULL and every other caller checks
> that. Assuming this situation is not expected, just jump to 'err' label
> without queueing an explicit error message.
> 
> Fixes: 2be1d52644cf7 ("src: Add tproxy support")
> Signed-off-by: Phil Sutter <phil@nwl.cc>

Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>

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

end of thread, other threads:[~2019-10-21 15:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 14:40 [nft PATCH] tproxy: Add missing error checking when parsing from netlink Phil Sutter
2019-10-21 15:59 ` 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.