svn commit: r349631 - stable/11/sbin/dhclient
Mark Johnston
markj at FreeBSD.org
Wed Jul 3 00:35:16 UTC 2019
Author: markj
Date: Wed Jul 3 00:35:14 2019
New Revision: 349631
URL: https://svnweb.freebsd.org/changeset/base/349631
Log:
MFC r349438:
Avoid a divide-by-zero when bad checksum counters overflow.
Modified:
stable/11/sbin/dhclient/packet.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sbin/dhclient/packet.c
==============================================================================
--- stable/11/sbin/dhclient/packet.c Wed Jul 3 00:32:42 2019 (r349630)
+++ stable/11/sbin/dhclient/packet.c Wed Jul 3 00:35:14 2019 (r349631)
@@ -181,7 +181,7 @@ decode_udp_ip_header(unsigned char *buf, int bufix, st
ip_packets_seen++;
if (wrapsum(checksum(buf + bufix, ip_len, 0)) != 0) {
ip_packets_bad_checksum++;
- if (ip_packets_seen > 4 &&
+ if (ip_packets_seen > 4 && ip_packets_bad_checksum != 0 &&
(ip_packets_seen / ip_packets_bad_checksum) < 2) {
note("%d bad IP checksums seen in %d packets",
ip_packets_bad_checksum, ip_packets_seen);
@@ -233,7 +233,7 @@ decode_udp_ip_header(unsigned char *buf, int bufix, st
udp_packets_seen++;
if (usum && usum != sum) {
udp_packets_bad_checksum++;
- if (udp_packets_seen > 4 &&
+ if (udp_packets_seen > 4 && udp_packets_bad_checksum != 0 &&
(udp_packets_seen / udp_packets_bad_checksum) < 2) {
note("%d bad udp checksums in %d packets",
udp_packets_bad_checksum, udp_packets_seen);
More information about the svn-src-all
mailing list