From 72386012200a96f9bb721ab4ddb5a9325c68c5f7 Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Wed, 20 Sep 2017 21:53:09 +0530 Subject: src: Buffer is null terminated. In _snprintf() functions definition the buffer is null terminated. Signed-off-by: Varsha Rao Signed-off-by: Pablo Neira Ayuso --- src/expr.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/expr.c') diff --git a/src/expr.c b/src/expr.c index a077cce..c5fcf06 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, remain = size; + if (size) + buf[0] = '\0'; + if (!expr->ops->snprintf) return 0; -- cgit v1.2.3