From owner-freebsd-bugs Sat Jul 8 22:40: 5 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id BC46737BFD8 for ; Sat, 8 Jul 2000 22:40:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id WAA00634; Sat, 8 Jul 2000 22:40:00 -0700 (PDT) (envelope-from gnats@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 To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/19793: [PATCH] ipfilter - improve line reading Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 19793 >Category: misc >Synopsis: [PATCH] ipfilter - improve line reading >Confidential: no >Severity: non-critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jul 08 22:40:00 PDT 2000 >Closed-Date: >Last-Modified: >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 >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: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message