bin/174631: Sizeof ebuf is wrong in tftp-io.c .

Henning Petersen henning.petersen at t-online.de
Sat Dec 22 12:40:01 UTC 2012


>Number:         174631
>Category:       bin
>Synopsis:       Sizeof ebuf is wrong in tftp-io.c .
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 22 12:40:00 UTC 2012
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:


More information about the freebsd-bugs mailing list