From nobody@FreeBSD.org  Mon Jul  7 13:45:26 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1827F1065670
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  7 Jul 2008 13:45:26 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 060AC8FC1C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  7 Jul 2008 13:45:26 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m67DjPAc017206
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 7 Jul 2008 13:45:25 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m67DjP6m017205;
	Mon, 7 Jul 2008 13:45:25 GMT
	(envelope-from nobody)
Message-Id: <200807071345.m67DjP6m017205@www.freebsd.org>
Date: Mon, 7 Jul 2008 13:45:25 GMT
From: Sergey Matveychuk <sem@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [ipfw] increase a line buffer limit
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         125370
>Category:       bin
>Synopsis:       [ipfw] [patch] increase a line buffer limit
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ipfw
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 07 13:50:06 UTC 2008
>Closed-Date:    Mon Jun 20 13:54:54 UTC 2011
>Last-Modified:  Mon Jun 20 13:54:54 UTC 2011
>Originator:     Sergey Matveychuk
>Release:        7.0-STABLE
>Organization:
Yandex LLC
>Environment:
FreeBSD xxx 7.0-STABLE FreeBSD 7.0-STABLE #0: Thu Jun 26 14:07:01 MSD 2008     root@xxx:/usr/src/sys/i386/compile/XXX  i386
>Description:
When ipfw read command from a file it use BUFSIZE (=1024) as a line size limit. We have longer lines in our firewall and there is no reason for the limit really.
The patch increase the buffer limit to 4kb.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- ipfw2.c.orig	2008-07-07 16:28:20.000000000 +0400
+++ ipfw2.c	2008-07-07 16:28:48.000000000 +0400
@@ -6281,7 +6281,7 @@
 ipfw_readfile(int ac, char *av[])
 {
 #define MAX_ARGS	32
-	char	buf[BUFSIZ];
+	char	buf[4096];
 	char	*cmd = NULL, *filename = av[ac-1];
 	int	c, lineno=0;
 	FILE	*f = NULL;
@@ -6383,7 +6383,7 @@
 		}
 	}
 
-	while (fgets(buf, BUFSIZ, f)) {		/* read commands */
+	while (fgets(buf, sizeof(buf), f)) {		/* read commands */
 		char linename[10];
 		char *args[1];
 


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-ipfw 
Responsible-Changed-By: sem 
Responsible-Changed-When: Mon Jul 7 14:06:09 UTC 2008 
Responsible-Changed-Why:  
Over to maintainer 

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

From: Dmitry Sivachenko <demon@FreeBSD.org>
To: bug-followup@FreeBSD.org, sem@FreeBSD.org
Cc:  
Subject: Re: bin/125370: [ipfw] [patch] increase a line buffer limit
Date: Wed, 20 Jan 2010 15:01:09 +0300

 Hello!
 
 Are there any strong reasons why this patch can't be committed?
 
 Thanks!
State-Changed-From-To: open->patched 
State-Changed-By: ae 
State-Changed-When: Mon Jun 6 10:52:50 UTC 2011 
State-Changed-Why:  
Patched in head/. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/125370: commit references a PR
Date: Mon,  6 Jun 2011 10:52:40 +0000 (UTC)

 Author: ae
 Date: Mon Jun  6 10:52:26 2011
 New Revision: 222744
 URL: http://svn.freebsd.org/changeset/base/222744
 
 Log:
   Increase buffer size for the command line.
   
   PR:		bin/125370
   Submitted by:	sem
   MFC after:	2 weeks
 
 Modified:
   head/sbin/ipfw/main.c
 
 Modified: head/sbin/ipfw/main.c
 ==============================================================================
 --- head/sbin/ipfw/main.c	Mon Jun  6 10:51:00 2011	(r222743)
 +++ head/sbin/ipfw/main.c	Mon Jun  6 10:52:26 2011	(r222744)
 @@ -444,7 +444,7 @@ static void
  ipfw_readfile(int ac, char *av[])
  {
  #define MAX_ARGS	32
 -	char	buf[BUFSIZ];
 +	char buf[4096];
  	char *progname = av[0];		/* original program name */
  	const char *cmd = NULL;		/* preprocessor name, if any */
  	const char *filename = av[ac-1]; /* file to read */
 @@ -552,7 +552,7 @@ ipfw_readfile(int ac, char *av[])
  		}
  	}
  
 -	while (fgets(buf, BUFSIZ, f)) {		/* read commands */
 +	while (fgets(buf, sizeof(buf), f)) {		/* read commands */
  		char linename[20];
  		char *args[2];
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/125370: commit references a PR
Date: Mon, 20 Jun 2011 13:46:58 +0000 (UTC)

 Author: ae
 Date: Mon Jun 20 13:46:38 2011
 New Revision: 223336
 URL: http://svn.freebsd.org/changeset/base/223336
 
 Log:
   MFC r222744:
     Increase buffer size for the command line.
   
     PR:		bin/125370
 
 Modified:
   stable/8/sbin/ipfw/main.c
 Directory Properties:
   stable/8/sbin/ipfw/   (props changed)
 
 Modified: stable/8/sbin/ipfw/main.c
 ==============================================================================
 --- stable/8/sbin/ipfw/main.c	Mon Jun 20 12:40:21 2011	(r223335)
 +++ stable/8/sbin/ipfw/main.c	Mon Jun 20 13:46:38 2011	(r223336)
 @@ -444,7 +444,7 @@ static void
  ipfw_readfile(int ac, char *av[])
  {
  #define MAX_ARGS	32
 -	char	buf[BUFSIZ];
 +	char buf[4096];
  	char *progname = av[0];		/* original program name */
  	const char *cmd = NULL;		/* preprocessor name, if any */
  	const char *filename = av[ac-1]; /* file to read */
 @@ -552,7 +552,7 @@ ipfw_readfile(int ac, char *av[])
  		}
  	}
  
 -	while (fgets(buf, BUFSIZ, f)) {		/* read commands */
 +	while (fgets(buf, sizeof(buf), f)) {		/* read commands */
  		char linename[20];
  		char *args[2];
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/125370: commit references a PR
Date: Mon, 20 Jun 2011 13:47:18 +0000 (UTC)

 Author: ae
 Date: Mon Jun 20 13:46:57 2011
 New Revision: 223337
 URL: http://svn.freebsd.org/changeset/base/223337
 
 Log:
   MFC r222744:
     Increase buffer size for the command line.
   
     PR:		bin/125370
 
 Modified:
   stable/7/sbin/ipfw/main.c
 Directory Properties:
   stable/7/sbin/ipfw/   (props changed)
 
 Modified: stable/7/sbin/ipfw/main.c
 ==============================================================================
 --- stable/7/sbin/ipfw/main.c	Mon Jun 20 13:46:38 2011	(r223336)
 +++ stable/7/sbin/ipfw/main.c	Mon Jun 20 13:46:57 2011	(r223337)
 @@ -382,7 +382,7 @@ static void
  ipfw_readfile(int ac, char *av[])
  {
  #define MAX_ARGS	32
 -	char	buf[BUFSIZ];
 +	char buf[4096];
  	char *progname = av[0];		/* original program name */
  	const char *cmd = NULL;		/* preprocessor name, if any */
  	const char *filename = av[ac-1]; /* file to read */
 @@ -490,7 +490,7 @@ ipfw_readfile(int ac, char *av[])
  		}
  	}
  
 -	while (fgets(buf, BUFSIZ, f)) {		/* read commands */
 +	while (fgets(buf, sizeof(buf), f)) {		/* read commands */
  		char linename[20];
  		char *args[2];
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: ae 
State-Changed-When: Mon Jun 20 13:54:23 UTC 2011 
State-Changed-Why:  
Merged to stable/8 and stable/7. Thanks! 

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