Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Dec 2010 05:16:26 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r216347 - stable/7/sbin/ipfw
Message-ID:  <201012100516.oBA5GQ9n062205@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Fri Dec 10 05:16:25 2010
New Revision: 216347
URL: http://svn.freebsd.org/changeset/base/216347

Log:
  MFC r206494 by luigi:
    fix a buffer overflow with large (100k+) number of input lines.
  
  Approved by:	re (bz)

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	Fri Dec 10 05:15:47 2010	(r216346)
+++ stable/7/sbin/ipfw/main.c	Fri Dec 10 05:16:25 2010	(r216347)
@@ -491,11 +491,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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012100516.oBA5GQ9n062205>