From alex@kapran.bitmcnit.bryansk.su  Thu Jul 20 00:01:29 2000
Return-Path: <alex@kapran.bitmcnit.bryansk.su>
Received: from server.bitmcnit.bryansk.su (bitmcnit.bryansk.ru [195.239.213.9])
	by hub.freebsd.org (Postfix) with ESMTP id 54B7A37BBC3
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 20 Jul 2000 00:01:17 -0700 (PDT)
	(envelope-from alex@kapran.bitmcnit.bryansk.su)
Received: (from uucp@localhost)
	by server.bitmcnit.bryansk.su (8.9.3/8.9.3) with UUCP id KAA20757
	for FreeBSD-gnats-submit@freebsd.org; Thu, 20 Jul 2000 10:51:21 +0400
Received: (from alex@localhost)
	by kapran.bitmcnit.bryansk.su (8.9.3/8.9.3) id KAA04040;
	Thu, 20 Jul 2000 10:46:59 +0400 (MSD)
	(envelope-from alex)
Message-Id: <200007200646.KAA04040@kapran.bitmcnit.bryansk.su>
Date: Thu, 20 Jul 2000 10:46:59 +0400 (MSD)
From: Alex Kapranoff <alex@kapran.bitmcnit.bryansk.su>
Reply-To: alex@kapran.bitmcnit.bryansk.su
To: FreeBSD-gnats-submit@freebsd.org
Subject: lengthen ALIGNed buffer in telnet/commands.c
X-Send-Pr-Version: 3.2

>Number:         20053
>Category:       bin
>Synopsis:       lengthen ALIGNed buffer in telnet/commands.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ume
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 20 00:10:05 PDT 2000
>Closed-Date:    Thu Jul 20 08:04:01 PDT 2000
>Last-Modified:  Thu Jul 20 08:05:05 PDT 2000
>Originator:     Alex Kapranoff
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:

	usr.bin/telnet/commands.c,v 1.24

>Description:

	While I was cleaning up a warning with ALIGN(buf) assigned to a pointer,
	I seem to manage to fix a possible subtle error. On 2904 line we
	get an ALIGNed pointer to a char buf[1024] and then use 1024 as
	the length of the (already ALIGNed) buffer. ALIGN can shift a
	pointer by up to ALIGNBYTES and therefore in order to get a whole of 1024
	bytes buffer we need to declare it as char buf[1024 + ALIGNBYTES].

>How-To-Repeat:

	

>Fix:

--- commands.c.ctm	Thu Jul 20 10:18:03 2000
+++ commands.c	Thu Jul 20 10:43:41 2000
@@ -2859,7 +2859,7 @@
 	int	*protop;
 	int	*optp;
 {
-	static char buf[1024];	/*XXX*/
+	static char buf[1024 + ALIGNBYTES];	/*XXX*/
 	struct cmsghdr *cmsg;
 #ifdef	sysV88
 	static IOPTN ipopt;
@@ -2901,7 +2901,7 @@
 		lsrp = *cpp;
 		ep = lsrp + *lenp;
 	} else {
-		*cpp = lsrp = ALIGN(buf);
+		*cpp = lsrp = (char *)ALIGN(buf);
 		ep = lsrp + 1024;
 	}
 

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->ume 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Thu Jul 20 00:18:44 PDT 2000 
Responsible-Changed-Why:  
Umemoto-san, this seems to pertain to shin's rev 1.14 of 
commands.c.  Could you take a look? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20053 
State-Changed-From-To: open->closed 
State-Changed-By: ume 
State-Changed-When: Thu Jul 20 08:04:01 PDT 2000 
State-Changed-Why:  
Thanks!  Committed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20053 
>Unformatted:
