Skip to contentSkip to conversation

expr: call expr->ops->snprintf only if defined

PATCH New Pablo Neira Ayuso 1 participant 1 message Nov 29, 2016 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 src/expr.c | 3 +++
 1 file changed, 3 insertions(+)
src/expr.c +3 -0
index 2779b3c42217..8d5c56206867 100644
@@ -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);
 
Signature · 1 line
2.1.4