Bug 174631

Summary: [libexec] [patch] Sizeof ebuf is wrong in tftp-io.c .
Product: Base System Reporter: henning.petersen
Component: binAssignee: Antoine Brodin <antoine>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description henning.petersen 2012-12-22 12:40:00 UTC
Sieof ebuf is wrong, sizeof buf is used.

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:
Comment 1 Antoine Brodin freebsd_committer freebsd_triage 2012-12-25 17:03:51 UTC
Responsible Changed
From-To: freebsd-bugs->antoine

Take.
Comment 2 dfilter service freebsd_committer freebsd_triage 2012-12-25 17:06:27 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"
Comment 3 Antoine Brodin freebsd_committer freebsd_triage 2012-12-25 17:07:10 UTC
State Changed
From-To: open->patched

Patched in head.
Comment 4 dfilter service freebsd_committer freebsd_triage 2013-02-02 13:47:52 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"
Comment 5 Antoine Brodin freebsd_committer freebsd_triage 2013-02-02 13:52:00 UTC
State Changed
From-To: patched->closed

Patch committed in head and stable/9, thanks!
Comment 6 dfilter service freebsd_committer freebsd_triage 2013-03-02 17:18:56 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"