From nobody@FreeBSD.org  Sat Dec 22 12:37:10 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 7FDA8914
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 22 Dec 2012 12:37:10 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 64EE78FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 22 Dec 2012 12:37:10 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id qBMCb98h011780
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 22 Dec 2012 12:37:09 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id qBMCb9Ux011779;
	Sat, 22 Dec 2012 12:37:09 GMT
	(envelope-from nobody)
Message-Id: <201212221237.qBMCb9Ux011779@red.freebsd.org>
Date: Sat, 22 Dec 2012 12:37:09 GMT
From: Henning Petersen <henning.petersen@t-online.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Sizeof ebuf is wrong in tftp-io.c .
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         174631
>Category:       bin
>Synopsis:       [libexec] [patch] Sizeof ebuf is wrong in tftp-io.c .
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    antoine
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 22 12:40:00 UTC 2012
>Closed-Date:    Sat Feb 02 13:53:11 UTC 2013
>Last-Modified:  Sat Mar  2 17:20:00 UTC 2013
>Originator:     Henning Petersen
>Release:        Freebsd-current
>Organization:
>Environment:
>Description:
Sieof ebuf is wrong, sizeof buf is used.
>How-To-Repeat:

>Fix:
diff -u -p -r1.8 tftp-io.c
--- libexec/tftpd/tftp-io.c	17 Nov 2012 01:50:12 -0000	1.8
+++ libexec/tftpd/tftp-io.c	22 Dec 2012 11:17:19 -0000
@@ -87,14 +87,13 @@ errtomsg(int error)
 {
 	static char ebuf[40];
 	struct errmsg *pe;
-	char buf[MAXPKTSIZE];
 
 	if (error == 0)
 		return ("success");
 	for (pe = errmsgs; pe->e_code >= 0; pe++)
 		if (pe->e_code == error)
 			return (pe->e_msg);
-	snprintf(ebuf, sizeof(buf), "error %d", error);
+	snprintf(ebuf, sizeof(ebuf), "error %d", error);
 	return (ebuf);
 }


Patch attached with submission follows:

diff -u -p -r1.8 tftp-io.c
--- libexec/tftpd/tftp-io.c	17 Nov 2012 01:50:12 -0000	1.8
+++ libexec/tftpd/tftp-io.c	22 Dec 2012 11:17:19 -0000
@@ -87,14 +87,13 @@ errtomsg(int error)
 {
 	static char ebuf[40];
 	struct errmsg *pe;
-	char buf[MAXPKTSIZE];
 
 	if (error == 0)
 		return ("success");
 	for (pe = errmsgs; pe->e_code >= 0; pe++)
 		if (pe->e_code == error)
 			return (pe->e_msg);
-	snprintf(ebuf, sizeof(buf), "error %d", error);
+	snprintf(ebuf, sizeof(ebuf), "error %d", error);
 	return (ebuf);
 }
 


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->antoine 
Responsible-Changed-By: antoine 
Responsible-Changed-When: Tue Dec 25 17:03:51 UTC 2012 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=174631 
State-Changed-From-To: open->patched 
State-Changed-By: antoine 
State-Changed-When: Tue Dec 25 17:07:10 UTC 2012 
State-Changed-Why:  
Patched in head. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=174631 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/174631: commit references a PR
Date: Tue, 25 Dec 2012 17:06:27 +0000 (UTC)

 Author: antoine
 Date: Tue Dec 25 17:06:05 2012
 New Revision: 244686
 URL: http://svnweb.freebsd.org/changeset/base/244686
 
 Log:
   Use correct size in snprintf.
   Remove unused buffer.
   
   PR:		174631
   Submitted by:	Henning Petersen
   MFC after:	1 month
 
 Modified:
   head/libexec/tftpd/tftp-io.c
 
 Modified: head/libexec/tftpd/tftp-io.c
 ==============================================================================
 --- head/libexec/tftpd/tftp-io.c	Tue Dec 25 16:44:50 2012	(r244685)
 +++ head/libexec/tftpd/tftp-io.c	Tue Dec 25 17:06:05 2012	(r244686)
 @@ -87,14 +87,13 @@ errtomsg(int error)
  {
  	static char ebuf[40];
  	struct errmsg *pe;
 -	char buf[MAXPKTSIZE];
  
  	if (error == 0)
  		return ("success");
  	for (pe = errmsgs; pe->e_code >= 0; pe++)
  		if (pe->e_code == error)
  			return (pe->e_msg);
 -	snprintf(ebuf, sizeof(buf), "error %d", error);
 +	snprintf(ebuf, sizeof(ebuf), "error %d", error);
  	return (ebuf);
  }
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/174631: commit references a PR
Date: Sat,  2 Feb 2013 13:47:52 +0000 (UTC)

 Author: antoine
 Date: Sat Feb  2 13:47:34 2013
 New Revision: 246253
 URL: http://svnweb.freebsd.org/changeset/base/246253
 
 Log:
   MFC r244686 to stable/9:
   Use correct size in snprintf.
   Remove unused buffer.
   
   PR:		174631
   Submitted by:	Henning Petersen
 
 Modified:
   stable/9/libexec/tftpd/tftp-io.c
 Directory Properties:
   stable/9/libexec/tftpd/   (props changed)
 
 Modified: stable/9/libexec/tftpd/tftp-io.c
 ==============================================================================
 --- stable/9/libexec/tftpd/tftp-io.c	Sat Feb  2 12:52:43 2013	(r246252)
 +++ stable/9/libexec/tftpd/tftp-io.c	Sat Feb  2 13:47:34 2013	(r246253)
 @@ -87,14 +87,13 @@ errtomsg(int error)
  {
  	static char ebuf[40];
  	struct errmsg *pe;
 -	char buf[MAXPKTSIZE];
  
  	if (error == 0)
  		return ("success");
  	for (pe = errmsgs; pe->e_code >= 0; pe++)
  		if (pe->e_code == error)
  			return (pe->e_msg);
 -	snprintf(ebuf, sizeof(buf), "error %d", error);
 +	snprintf(ebuf, sizeof(ebuf), "error %d", error);
  	return (ebuf);
  }
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: antoine 
State-Changed-When: Sat Feb 2 13:52:00 UTC 2013 
State-Changed-Why:  
Patch committed in head and stable/9, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=174631 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/174631: commit references a PR
Date: Sat,  2 Mar 2013 17:18:56 +0000 (UTC)

 Author: marius
 Date: Sat Mar  2 17:18:38 2013
 New Revision: 247646
 URL: http://svnweb.freebsd.org/changeset/base/247646
 
 Log:
   MFC: r244686
   
   Use correct size in snprintf.
   Remove unused buffer.
   
   PR:		174631
   Submitted by:	Henning Petersen
 
 Modified:
   stable/8/libexec/tftpd/tftp-io.c
 Directory Properties:
   stable/8/libexec/tftpd/   (props changed)
 
 Modified: stable/8/libexec/tftpd/tftp-io.c
 ==============================================================================
 --- stable/8/libexec/tftpd/tftp-io.c	Sat Mar  2 17:14:53 2013	(r247645)
 +++ stable/8/libexec/tftpd/tftp-io.c	Sat Mar  2 17:18:38 2013	(r247646)
 @@ -87,14 +87,13 @@ errtomsg(int error)
  {
  	static char ebuf[40];
  	struct errmsg *pe;
 -	char buf[MAXPKTSIZE];
  
  	if (error == 0)
  		return ("success");
  	for (pe = errmsgs; pe->e_code >= 0; pe++)
  		if (pe->e_code == error)
  			return (pe->e_msg);
 -	snprintf(ebuf, sizeof(buf), "error %d", error);
 +	snprintf(ebuf, sizeof(ebuf), "error %d", error);
  	return (ebuf);
  }
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
