Use strlcpy for copy resolved src/dst hostname.
Signed-off-by: Vadim Kochan <[email protected]>
---
flowtop.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/flowtop.c b/flowtop.c
index cfe76d5..50064bb 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -730,12 +730,9 @@ static void flow_entry_get_extended_revdns(struct
flow_entry *n,
getnameinfo(sa, sa_len, SELFLD(dir, rev_dns_src, rev_dns_dst),
sizeof(n->rev_dns_src), NULL, 0, NI_NUMERICHOST);
- if (hent) {
- memset(n->rev_dns_dst, 0, sizeof(n->rev_dns_dst));
- memcpy(SELFLD(dir, rev_dns_src, rev_dns_dst),
- hent->h_name, min(sizeof(n->rev_dns_src),
- strlen(hent->h_name)));
- }
+ if (hent)
+ strlcpy(SELFLD(dir, rev_dns_src, rev_dns_dst), hent->h_name,
+ min(sizeof(n->rev_dns_src), strlen(hent->h_name) + 1));
}
static void flow_entry_get_extended(struct flow_entry *n)
--
2.6.1
--
You received this message because you are subscribed to the Google Groups
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.