From owner-freebsd-net Wed Oct 2 4:16: 4 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A094B37B401 for ; Wed, 2 Oct 2002 04:16:03 -0700 (PDT) Received: from lion.com.ua (lion.com.ua [213.133.161.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id 68D1C43E65 for ; Wed, 2 Oct 2002 04:15:59 -0700 (PDT) (envelope-from sa@simon.org.ua) Received: from localhost (localhost [127.0.0.1]) by lion.com.ua (8.12.5/8.12.5) with ESMTP id g92BFgvI001118 for ; Wed, 2 Oct 2002 14:15:47 +0300 (EEST) (envelope-from sa@simon.org.ua) Date: Wed, 2 Oct 2002 14:15:42 +0300 (EEST) From: Andrey Simonenko X-X-Sender: sa@lion.com.ua To: freebsd-net@freebsd.org Subject: Q about sbin/ipfw2.c:list() Message-ID: <20021002141006.A1093-100000@lion.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hello, Why is it needed to check both r->rulenum and (void *)r < lim in sbin/ipfw2.c:list() ? /* * Count static rules. They have variable size so we * need to scan the list to count them. */ for (nstat = 1, r = data, lim = data + nbytes; r->rulenum < 65535 && (void *)r < lim; ++nstat, r = (void *)r + RULESIZE(r) ) ; /* nothing */ Can I simply check r->rulenum < 65535 as it is done in sbin/ipfw.c:list() ? TIA ps: please CC to my email. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message