Obey POSIX on printf("%.s", (char*)NULL).
* libc/stdio/vfprintf.c (_VFPRINTF_R): Take precision into account for %s on NULL. Skip NULL check when optimizing for size.
This commit is contained in:
		| @@ -1,3 +1,9 @@ | ||||
| 2007-09-17  Eric Blake  <ebb9@byu.net> | ||||
|  | ||||
| 	Obey POSIX on printf("%.s", (char*)NULL). | ||||
| 	* libc/stdio/vfprintf.c (_VFPRINTF_R): Take precision into account | ||||
| 	for %s on NULL.  Skip NULL check when optimizing for size. | ||||
|  | ||||
| 2007-09-07  Jeff Johnston  <jjohnstn@redhat.com> | ||||
|  | ||||
| 	* libc/include/sys/_types.h: Protect all types with flag | ||||
| @@ -44,11 +50,11 @@ | ||||
|  | ||||
| 2007-08-31  Antony King  <antony.king@st.com> | ||||
|  | ||||
|         * libc/stdlib/mprec.h [_DOUBLE_IS_32BITS}: Define IEEE_Arith | ||||
| 	* libc/stdlib/mprec.h [_DOUBLE_IS_32BITS}: Define IEEE_Arith | ||||
| 	bits and redefine associated dword0 macro (rvalue issue). | ||||
| 	* libc/stdio/vfieeefp.h: Ditto. | ||||
|         * libc/stdlib/strtod.c: Add checks for _DOUBLE_IS_32BITS | ||||
|         to prevent setting dword1 which is an rvalue only. | ||||
| 	* libc/stdlib/strtod.c: Add checks for _DOUBLE_IS_32BITS | ||||
| 	to prevent setting dword1 which is an rvalue only. | ||||
|  | ||||
| 2007-08-28  Hans Kester  <hans.kester@ellips.nl> | ||||
|  | ||||
|   | ||||
| @@ -1029,10 +1029,17 @@ reswitch:	switch (ch) { | ||||
| 		case 'S': | ||||
| #endif | ||||
| 			sign = '\0'; | ||||
| 			if ((cp = GET_ARG (N, ap, char_ptr_t)) == NULL) { | ||||
| 			cp = GET_ARG (N, ap, char_ptr_t); | ||||
| #ifndef __OPTIMIZE_SIZE__ | ||||
| 			/* Behavior is undefined if the user passed a | ||||
| 			   NULL string when precision is not 0. | ||||
| 			   However, if we are not optimizing for size, | ||||
| 			   we might as well mirror glibc behavior.  */ | ||||
| 			if (cp == NULL) { | ||||
| 				cp = "(null)"; | ||||
| 				size = 6; | ||||
| 				size = ((unsigned) prec > 6U) ? 6 : prec; | ||||
| 			} | ||||
| #endif /* __OPTIMIZE_SIZE__ */ | ||||
| #ifdef _MB_CAPABLE | ||||
| 			else if (ch == 'S' || (flags & LONGINT)) { | ||||
| 				mbstate_t ps; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user