diff options
author | Vadim Kochan <vadim4j@gmail.com> | 2015-10-27 02:00:47 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-10-27 11:38:20 +0100 |
commit | 5a59952a9ae0820b939572454374b9df03f04c44 (patch) | |
tree | 85f6716fac2faeab7062d361e465be40421b8f10 /flowtop.c | |
parent | d91abbd912399a1d29cc77e4be7b7d6f94014180 (diff) |
flowtop: Fix src hostname showed with garbage
Use strlcpy to copy resolved src/dst hostname.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
[tk: Remove superflous min() for size argument]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'flowtop.c')
-rw-r--r-- | flowtop.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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, + sizeof(n->rev_dns_src)); } static void flow_entry_get_extended(struct flow_entry *n) |