Date: Fri, 14 Apr 2017 11:58:41 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316826 - head/sys/netpfil/ipfw/nat64 Message-ID: <201704141158.v3EBwfLm003147@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Fri Apr 14 11:58:41 2017 New Revision: 316826 URL: https://svnweb.freebsd.org/changeset/base/316826 Log: Avoid undefined behavior. The 'pktid' variable is modified while being used twice between sequence points, probably due to htonl() is macro. Reported by: PVS-Studio MFC after: 1 week Modified: head/sys/netpfil/ipfw/nat64/nat64stl.c Modified: head/sys/netpfil/ipfw/nat64/nat64stl.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64stl.c Fri Apr 14 11:41:09 2017 (r316825) +++ head/sys/netpfil/ipfw/nat64/nat64stl.c Fri Apr 14 11:58:41 2017 (r316826) @@ -75,7 +75,8 @@ nat64stl_log(struct pfloghdr *plog, stru plog->action = PF_NAT; plog->dir = PF_IN; plog->rulenr = htonl(kidx); - plog->subrulenr = htonl(++pktid); + pktid++; + plog->subrulenr = htonl(pktid); plog->ruleset[0] = '\0'; strlcpy(plog->ifname, "NAT64STL", sizeof(plog->ifname)); ipfw_bpf_mtap2(plog, PFLOG_HDRLEN, m);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704141158.v3EBwfLm003147>