SHA256
1
0
forked from pool/libnftnl
libnftnl/bufferov.diff

30 lines
853 B
Diff

From: Jan Engelhardt <jengelh@inai.de>
Date: 2017-10-13 02:43:06.480980575 +0200
X-Upstream: reported
resolve a potential buffer overflow when i > 9
[reg->len > 36].
expr/data_reg.c:69:27: warning: '%d' directive writing between 1 and
10 bytes into a region of size 2 [-Wformat-overflow=]
sprintf(node_name, "data%d", i);
---
src/expr/data_reg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: libnftnl-1.0.8/src/expr/data_reg.c
===================================================================
--- libnftnl-1.0.8/src/expr/data_reg.c
+++ libnftnl-1.0.8/src/expr/data_reg.c
@@ -60,7 +60,7 @@ static int nftnl_data_reg_value_json_par
struct nftnl_parse_err *err)
{
int i;
- char node_name[6];
+ char node_name[16];
if (nftnl_jansson_parse_val(data, "len", NFTNL_TYPE_U8, &reg->len, err) < 0)
return DATA_NONE;