fix a buffer overflow with large (100k+) number of input lines.

MFC after:	3 days
This commit is contained in:
Luigi Rizzo 2010-04-12 08:27:53 +00:00
parent 92cb9b0578
commit c083134268
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=206494

View File

@ -553,11 +553,11 @@ ipfw_readfile(int ac, char *av[])
}
while (fgets(buf, BUFSIZ, f)) { /* read commands */
char linename[10];
char linename[20];
char *args[2];
lineno++;
sprintf(linename, "Line %d", lineno);
snprintf(linename, sizeof(linename), "Line %d", lineno);
setprogname(linename); /* XXX */
args[0] = progname;
args[1] = buf;