From 3d72695a45af769302d0d1b8ab44d14b8d003e3f Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 29 Nov 2016 21:34:31 +0100 Subject: expr: call expr->ops->snprintf only if defined The notrack expression comes with no ->ops->snprintf, so skip this from nftnl_expr_snprintf() if not set. Signed-off-by: Pablo Neira Ayuso --- src/expr.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/expr.c b/src/expr.c index 2779b3c..8d5c562 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); -- cgit v1.2.3