Date: Mon, 7 Jul 2008 13:45:25 GMT From: Sergey Matveychuk <sem@FreeBSD.org> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/125370: [ipfw] increase a line buffer limit Message-ID: <200807071345.m67DjP6m017205@www.freebsd.org> Resent-Message-ID: <200807071350.m67Do6D8083003@freefall.freebsd.org>
index | next in thread | raw e-mail
>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@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:
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807071345.m67DjP6m017205>
