netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] expr: call expr->ops->snprintf only if defined
@ 2016-11-29 20:40 Pablo Neira Ayuso
  0 siblings, 0 replies; only message in thread
From: Pablo Neira Ayuso @ 2016-11-29 20:40 UTC (permalink / raw)
  To: netfilter-devel

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@netfilter.org>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-29 20:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-29 20:40 [PATCH] expr: call expr->ops->snprintf only if defined Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).