diff options
author | Nardi Ivan <nardi.ivan@gmail.com> | 2022-11-07 18:38:40 +0100 |
---|---|---|
committer | Toni <matzeton@googlemail.com> | 2022-11-07 20:36:55 +0100 |
commit | 52b562c3280e8592c6a5452659a1cb4cffe26177 (patch) | |
tree | 0ca14056ad3c2876d27b559a570df08ca3434abb /src/lib/ndpi_utils.c | |
parent | 9e73d61fb0454a143dea6faa4a665c6b7875e195 (diff) |
Fix json export of ipv6 addresses
The "string" buffer was to short; better start using `INET6_ADDRSTRLEN`
as reported in the man page of `inet_ntop`.
Close: #1794
Diffstat (limited to 'src/lib/ndpi_utils.c')
-rw-r--r-- | src/lib/ndpi_utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index b7c687033..201480c4e 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -1516,7 +1516,7 @@ int ndpi_flow2json(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t src_port, u_int16_t dst_port, ndpi_protocol l7_protocol, ndpi_serializer *serializer) { - char src_name[32] = {'\0'}, dst_name[32] = {'\0'}; + char src_name[INET6_ADDRSTRLEN] = {'\0'}, dst_name[INET6_ADDRSTRLEN] = {'\0'}; if(ip_version == 4) { inet_ntop(AF_INET, &src_v4, src_name, sizeof(src_name)); |