From: Pablo Neira Ayuso Date: Tue, 29 Nov 2016 20:34:31 +0000 (+0100) Subject: expr: call expr->ops->snprintf only if defined X-Git-Tag: libnftnl-1.0.7~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d72695a45af769302d0d1b8ab44d14b8d003e3f;p=thirdparty%2Flibnftnl.git 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 --- diff --git a/src/expr.c b/src/expr.c index 2779b3c4..8d5c5620 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);