svn commit: r349630 - stable/12/sbin/dhclient

Mark Johnston markj at FreeBSD.org
Wed Jul 3 00:32:43 UTC 2019


Author: markj
Date: Wed Jul  3 00:32:42 2019
New Revision: 349630
URL: https://svnweb.freebsd.org/changeset/base/349630

Log:
  MFC r349438:
  Avoid a divide-by-zero when bad checksum counters overflow.

Modified:
  stable/12/sbin/dhclient/packet.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/dhclient/packet.c
==============================================================================
--- stable/12/sbin/dhclient/packet.c	Wed Jul  3 00:12:50 2019	(r349629)
+++ stable/12/sbin/dhclient/packet.c	Wed Jul  3 00:32:42 2019	(r349630)
@@ -183,7 +183,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);
@@ -235,7 +235,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