misc/140496: Maintainance update for sprintf.c

Jeremy Huddleston jeremyhu at apple.com
Thu Nov 12 03:10:04 UTC 2009


>Number:         140496
>Category:       misc
>Synopsis:       Maintainance update for sprintf.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:   Thu Nov 12 03:10:04 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Jeremy Huddleston
>Release:        8.0
>Organization:
Apple
>Environment:
NA
>Description:
Make sprintf use vsprintf like similar changes to other stdio functions.
>How-To-Repeat:

>Fix:
--- sprintf.c.bsdnew	2009-11-11 19:03:58.000000000 -0800
+++ sprintf.c	2009-11-11 19:04:47.000000000 -0800
@@ -46,17 +46,9 @@ sprintf(char * __restrict str, char cons
 {
 	int ret;
 	va_list ap;
-	FILE f;
 
-	f._file = -1;
-	f._flags = __SWR | __SSTR;
-	f._bf._base = f._p = (unsigned char *)str;
-	f._bf._size = f._w = INT_MAX;
-	f._orientation = 0;
-	memset(&f._mbstate, 0, sizeof(mbstate_t));
 	va_start(ap, fmt);
-	ret = __vfprintf(&f, fmt, ap);
+	ret = vsprintf(str, fmt, ap);
 	va_end(ap);
-	*f._p = 0;
 	return (ret);
 }


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list