bin/125370: [ipfw] increase a line buffer limit
Sergey Matveychuk
sem at FreeBSD.org
Mon Jul 7 13:50:07 UTC 2008
>Number: 125370
>Category: bin
>Synopsis: [ipfw] increase a line buffer limit
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Mon Jul 07 13:50:06 UTC 2008
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:
More information about the freebsd-bugs
mailing list