Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jul 2019 00:32:42 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r349630 - stable/12/sbin/dhclient
Message-ID:  <201907030032.x630Wg0I067377@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907030032.x630Wg0I067377>