This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug in _VFPRINTF_R


Hi,

I think there is a bug in _VFPRINTF_R (vfprintf.c) in the string case.

The code is :

               case 's':
#ifdef _WANT_IO_C99_FORMATS
               case 'S':
#endif
                       sign = '\0';
                       if ((cp = GET_ARG (N, ap, char_ptr_t)) == NULL) {
                               cp = "(null)";
                               size = 6;
                       }

I think if cp equals NULL, cp just should be empty. The code should be following :

case 's':
#ifdef _WANT_IO_C99_FORMATS
case 'S':
#endif
sign = '\0';
if ((cp = GET_ARG (N, ap, char_ptr_t)) == NULL) {
cp = "";
size = 0;
}


Thanks

Samuel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]