From nobody@FreeBSD.ORG  Sat Jul  8 22:32:24 2000
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 6C4AE37B6EB; Sat,  8 Jul 2000 22:32:24 -0700 (PDT)
Message-Id: <20000709053224.6C4AE37B6EB@hub.freebsd.org>
Date: Sat,  8 Jul 2000 22:32:24 -0700 (PDT)
From: spock@techfour.net
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] ipfilter - improve line reading
X-Send-Pr-Version: www-1.0

>Number:         19793
>Category:       misc
>Synopsis:       [PATCH] ipfilter - improve line reading
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    darrenr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jul 08 22:40:00 PDT 2000
>Closed-Date:    Mon Aug 21 23:36:17 PDT 2000
>Last-Modified:  Mon Aug 21 23:37:17 PDT 2000
>Originator:     Mike Heffner
>Release:        FreeBSD 5.0-CURRENT
>Organization:
>Environment:
FreeBSD 5.0-CURRENT #1: Tue Jul  4 22:23:05 EDT 2000 i386
>Description:
ipfilter does not support:
 1) no-newline-at-end-of-file case when reading a rulelist from a file.
 2) line continuation with "\", although it says it is supported in a code comment.
>How-To-Repeat:
Ipfilter should be able to read lines like:

pass in from\
any to any port = 23

block in all<EOF>
>Fix:
A patch similar to this should fix both problems:

--- /tmp/ipf.c	Wed Jul  5 00:20:50 2000
+++ contrib/ipfilter/ipf.c	Sun Jul  9 01:02:35 2000
@@ -347,12 +347,20 @@
 			if (fgets(p, s, file) == NULL)
 				return (NULL);
 			len = strlen(p);
+			if (p[len - 1] != '\n') {
+				p[len] = '\0';
+				break;
+			}
 			p[len - 1] = '\0';
-			if (p[len - 1] != '\\')
+			if (len < 2 || p[len - 2] != '\\')
 				break;
-			size -= len;
+			else {
+				/* Convert '\\' to a space so words don't run together */
+				p[len - 2] = ' ';
+				len--;
+			}
 		}
-	} while (*str == '\0' || *str == '\n');
+	} while (*str == '\0');
 	return (str);
 }

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->darrenr 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Mon Jul 10 05:22:28 PDT 2000 
Responsible-Changed-Why:  
Over to the ipfilter maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19793 

From: Mike Heffner <mheffner@mailandnews.com>
To: spock@techfour.net
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: RE: misc/19793: [PATCH] ipfilter - improve line reading
Date: Fri, 18 Aug 2000 01:02:51 -0400 (EDT)

 This has been fixed in the import of IP Filter 3.4.8, so this PR can be closed.
 
 Thanks
 
 -- 
   Mike Heffner  <spock@techfour.net>
   Fredericksburg, VA     ICQ# 882073
   http://my.ispchannel.com/~mheffner
 
State-Changed-From-To: open->closed 
State-Changed-By: dwmalone 
State-Changed-When: Mon Aug 21 23:36:17 PDT 2000 
State-Changed-Why:  
Closed at submitter's request, as problem has been fixed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19793 
>Unformatted:
