[PATCH] expr: call expr->ops->snprintf only if defined

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The notrack expression comes with no ->ops->snprintf, so skip this from
nftnl_expr_snprintf() if not set.

Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
 src/expr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/expr.c b/src/expr.c
index 2779b3c42217..8d5c56206867 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -281,6 +281,9 @@ int nftnl_expr_snprintf(char *buf, size_t size, const struct nftnl_expr *expr,
 	int ret;
 	unsigned int offset = 0, len = size;
 
+	if (!expr->ops->snprintf)
+		return 0;
+
 	ret = expr->ops->snprintf(buf+offset, len, type, flags, expr);
 	SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux