diff options
author | Eric van Gyzen <vangyzen@FreeBSD.org> | 2017-02-16 20:47:41 +0000 |
---|---|---|
committer | Eric van Gyzen <vangyzen@FreeBSD.org> | 2017-02-16 20:47:41 +0000 |
commit | 8144690af4574b7653d9845085667e1ef2a7f019 (patch) | |
tree | 1d851bd9e5aff1454c3358a206371940d5aa67d0 /sys/netpfil | |
parent | 643faabe0dc26a4b62b4b03797106cd4b003e856 (diff) | |
download | src-8144690af4574b7653d9845085667e1ef2a7f019.tar.gz src-8144690af4574b7653d9845085667e1ef2a7f019.zip |
Use inet_ntoa_r() instead of inet_ntoa() throughout the kernel
inet_ntoa() cannot be used safely in a multithreaded environment
because it uses a static local buffer. Instead, use inet_ntoa_r()
with a buffer on the caller's stack.
Suggested by: glebius, emaste
Reviewed by: gnn
MFC after: 2 weeks
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9625
Notes
Notes:
svn path=/head/; revision=313821
Diffstat (limited to 'sys/netpfil')
-rw-r--r-- | sys/netpfil/ipfw/ip_fw_log.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/netpfil/ipfw/ip_fw_log.c b/sys/netpfil/ipfw/ip_fw_log.c index 5ef8cf1abf0a..a8e53fe50381 100644 --- a/sys/netpfil/ipfw/ip_fw_log.c +++ b/sys/netpfil/ipfw/ip_fw_log.c @@ -211,6 +211,7 @@ ipfw_log(struct ip_fw_chain *chain, struct ip_fw *f, u_int hlen, TARG(cmd->arg1, pipe)); break; case O_FORWARD_IP: { + char buf[INET_ADDRSTRLEN]; ipfw_insn_sa *sa = (ipfw_insn_sa *)cmd; int len; struct in_addr dummyaddr; @@ -220,7 +221,7 @@ ipfw_log(struct ip_fw_chain *chain, struct ip_fw *f, u_int hlen, dummyaddr.s_addr = sa->sa.sin_addr.s_addr; len = snprintf(SNPARGS(action2, 0), "Forward to %s", - inet_ntoa(dummyaddr)); + inet_ntoa_r(dummyaddr, buf)); if (sa->sa.sin_port) snprintf(SNPARGS(action2, len), ":%d", |