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/masq.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/expr/masq.c') diff --git a/src/expr/masq.c b/src/expr/masq.c index 7c235d3..1c75ee9 100644 --- a/src/expr/masq.c +++ b/src/expr/masq.c @@ -190,6 +190,9 @@ static int nftnl_expr_masq_snprintf_default(char *buf, size_t len, static int nftnl_expr_masq_snprintf(char *buf, size_t len, uint32_t type, uint32_t flags, const struct nftnl_expr *e) { + if (len) + buf[0] = '\0'; + switch (type) { case NFTNL_OUTPUT_DEFAULT: return nftnl_expr_masq_snprintf_default(buf, len, e); -- cgit v1.2.3