diff options
author | Keith Marshall <keithmarshall@@users.sf.net> | 2008-08-27 20:23:42 +0000 |
---|---|---|
committer | Keith Marshall <keithmarshall@@users.sf.net> | 2008-08-27 20:23:42 +0000 |
commit | 05a6cb1bb28a148fa59f33414606e4fc7adc5778 (patch) | |
tree | 4eee75692a1ed090cf7b8103e367e7c7cb5c8e25 /winsup/mingw | |
parent | 25687b0f76a010eecdbbce44aea5b2ba328a537e (diff) | |
download | cygnal-05a6cb1bb28a148fa59f33414606e4fc7adc5778.tar.gz cygnal-05a6cb1bb28a148fa59f33414606e4fc7adc5778.tar.bz2 cygnal-05a6cb1bb28a148fa59f33414606e4fc7adc5778.zip |
Avoid access violations, passing NULL to printf( "...%s..." ).
Diffstat (limited to 'winsup/mingw')
-rw-r--r-- | winsup/mingw/ChangeLog | 9 | ||||
-rw-r--r-- | winsup/mingw/mingwex/stdio/pformat.c | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index dcc57c62a..0d6c2f677 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,12 @@ +2008-08-27 Keith Marshall <keithmarshall@users.sourceforge.net> + + Avoid access violations, passing NULL to printf( "...%s..." ); + (inconsistencency with MSVCRT and glibc, reported by Colin Harrison). + + * mingwex/stdio/pformat.c (__pformat_puts): Substitute "(null)" + for argument value, if caller passes a NULL pointer. + (__pformat_wcputs): Likewise, substitute L"(null)". + 2008-08-14 Keith Marshall <keithmarshall@users.sourceforge.net> Add missing dependencies for building libmingwex.a. diff --git a/winsup/mingw/mingwex/stdio/pformat.c b/winsup/mingw/mingwex/stdio/pformat.c index 82dbcd741..2e2411606 100644 --- a/winsup/mingw/mingwex/stdio/pformat.c +++ b/winsup/mingw/mingwex/stdio/pformat.c @@ -356,8 +356,10 @@ void __pformat_puts( const char *s, __pformat_t *stream ) * to the `__pformat()' output stream. * * This is implemented as a trivial call to `__pformat_putchars()', - * passing the length of the input string as the character count. + * passing the length of the input string as the character count, + * (after first verifying that the input pointer is not NULL). */ + if( s == NULL ) s = "(null)"; __pformat_putchars( s, strlen( s ), stream ); } @@ -434,8 +436,10 @@ void __pformat_wcputs( const wchar_t *s, __pformat_t *stream ) * the input string, to the `__pformat()' output stream. * * This is implemented as a trivial call to `__pformat_wputchars()', - * passing the length of the input string as the character count. + * passing the length of the input string as the character count, + * (after first verifying that the input pointer is not NULL). */ + if( s == NULL ) s = L"(null)"; __pformat_wputchars( s, wcslen( s ), stream ); } |