From nobody@FreeBSD.org  Tue Feb 22 22:00:24 2000
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21])
	by hub.freebsd.org (Postfix) with ESMTP id 7FAE537B7D1
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 22 Feb 2000 22:00:24 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.9.3/8.9.2) id WAA62291;
	Tue, 22 Feb 2000 22:00:24 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Message-Id: <200002230600.WAA62291@freefall.freebsd.org>
Date: Tue, 22 Feb 2000 22:00:24 -0800 (PST)
From: spock@techfour.net
Sender: nobody@FreeBSD.org
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] banner doesn't  allocate space for nul
X-Send-Pr-Version: www-1.0

>Number:         16926
>Category:       bin
>Synopsis:       [PATCH] banner doesn't  allocate space for nul
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    mikeh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 22 22:10:00 PST 2000
>Closed-Date:    Wed Jun 13 17:08:04 PDT 2001
>Last-Modified:  Wed Jun 13 17:08:29 PDT 2001
>Originator:     Mike Heffner
>Release:        4.0-current
>Organization:
>Environment:
FreeBSD 4.0-CURRENT #0: Sat Feb 19 20:05:45 EST 2000 
>Description:
Banner doesn't allocate enough memory for the nul character. Banner 
will seg fault if it's sent a string with any multiple of 4096 
characters, because the nul ends up being written onto an unmapped 
page. This patch was posted to -audit a few weeks ago.
>How-To-Repeat:
run banner with a multiple of 4096 character string
Ex: banner [4096]
>Fix:
apply the following patch and recompile.

Index: usr.bin/banner/banner.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/banner/banner.c,v
retrieving revision 1.7
diff -u -r1.7 banner.c
--- banner.c    1999/12/04 02:11:51     1.7
+++ banner.c    2000/02/02 16:15:08
@@ -1063,7 +1063,7 @@
        /* Have now read in the data. Next get the message to be printed. */
        if (*argv) {
                for(i=0, j=0; i < argc; i++)
-                       j += strlen(argv[i]) + (i != 0);
+                       j += strlen(argv[i]) + 1;
                if ((message = malloc(j)) == NULL)
                        err(1, "malloc");
                strcpy(message, *argv);
           


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->kris  
Responsible-Changed-By: kris 
Responsible-Changed-When: Fri Mar 3 22:23:41 PST 2000 
Responsible-Changed-Why:  
My bug, I'll fix :) Sorry for not responding to your mail.. 
Responsible-Changed-From-To: kris->mikeh 
Responsible-Changed-By: mikeh 
Responsible-Changed-When: Sun May 27 21:00:51 PDT 2001 
Responsible-Changed-Why:  
I just committed the fix for this. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=16926 
State-Changed-From-To: open->closed 
State-Changed-By: mikeh 
State-Changed-When: Wed Jun 13 17:08:04 PDT 2001 
State-Changed-Why:  
Fix has been MFCed. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=16926 
>Unformatted:
