Subject: bin/3169: /usr/src/sbin/ipf won't build
To: None <gnats-bugs@gnats.netbsd.org>
From: David Carrel <carrel@ipsec.com>
List: netbsd-bugs
Date: 01/30/1997 18:15:29
>Number: 3169
>Category: bin
>Synopsis: sbin/ipf won't build due to out of range comparison
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jan 30 18:35:01 1997
>Last-Modified:
>Originator: David Carrel
>Organization:
just me
>Release: source supped 30 Jan 1997
>Environment:
System: NetBSD spy 1.2B NetBSD 1.2B (SPOOGE) #6: Wed Jan 22 01:10:58 PST 1997 carrel@spy:/home/NetBSD/src.970121/sys/arch/i386/compile/SPOOGE i386
>Description:
/usr/src/sbin/ipf fails to build on my hp300 due to a bad
comparison on parse.c:114. The value -1 is cast to an unsigned char (which
is bad) and then compared to a char.
>How-To-Repeat:
Try to build on the hp300. I'm not sure why but the hp300 compiler
catches more errors than the i386 compiler. I'm not sure why, but it is
true.
>Fix:
The following patch fixes this:
*** parse.c.orig Thu Jan 30 17:53:16 1997
--- parse.c Thu Jan 30 18:11:31 1997
***************
*** 111,117 ****
cpp++;
if (*(*cpp + 11) == '(') {
fil.fr_icode = icmpcode(*cpp + 12);
! if (fil.fr_icode == (unsigned char)-1) {
fprintf(stderr,
"uncrecognised icmp code %s\n",
*cpp + 12);
--- 111,117 ----
cpp++;
if (*(*cpp + 11) == '(') {
fil.fr_icode = icmpcode(*cpp + 12);
! if (fil.fr_icode == -1) {
fprintf(stderr,
"uncrecognised icmp code %s\n",
*cpp + 12);
>Audit-Trail:
>Unformatted: