From 5a59952a9ae0820b939572454374b9df03f04c44 Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Tue, 27 Oct 2015 02:00:47 +0200 Subject: flowtop: Fix src hostname showed with garbage Use strlcpy to copy resolved src/dst hostname. Signed-off-by: Vadim Kochan [tk: Remove superflous min() for size argument] Signed-off-by: Tobias Klauser --- flowtop.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/flowtop.c b/flowtop.c index cfe76d5..9eda68c 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, + sizeof(n->rev_dns_src)); } static void flow_entry_get_extended(struct flow_entry *n) -- cgit v1.2.3-54-g00ecf net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-10-12 09:24:52 +0300
committerGuenter Roeck <linux@roeck-us.net>2016-10-17 10:16:20 -0700
commit94cdc5608b5561aeda80edda9c9223608a1da6fc (patch)
treed900738ae22626517919cd55b3b127d6c331a991
parent667f4bab81ea8357d260aa14bb6fb1a4834248d5 (diff)
hwmon: (max31790) potential ERR_PTR dereference
We should only dereference "data" after we check if it is an error pointer. Fixes: 54187ff9d766 ('hwmon: (max31790) Convert to use new hwmon registration API') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>