Patch for pformat.c in winsup/mingw CVS

Colin Harrison colin.harrison@virgin.net
Fri Aug 1 13:54:00 GMT 2008


Hi,

The latest CVS winsup/mingw runtime caused a crash, for me, in strlen() when
testing previously 'good' code built with it in the toolchain.
I found this patch fixed the problem for me, so it may be of help to
others...

--- ./mingw/mingwex/stdio/save_pformat.c        2008-07-29
00:24:20.000000000 +0100
+++ ./mingw/mingwex/stdio/pformat.c     2008-07-31 19:30:29.000000000 +0100
@@ -358,7 +358,7 @@
    * This is implemented as a trivial call to `__pformat_putchars()',
    * passing the length of the input string as the character count.
    */
-  __pformat_putchars( s, strlen( s ), stream );
+  __pformat_putchars( s, s ? strlen( s ) : 0, stream );
 }

 static
@@ -436,7 +436,7 @@
    * This is implemented as a trivial call to `__pformat_wputchars()',
    * passing the length of the input string as the character count.
    */
-  __pformat_wputchars( s, wcslen( s ), stream );
+  __pformat_wputchars( s, s ? wcslen( s ) : 0, stream );
 }

 static __inline__

Thanks
Colin Harrison



More information about the Cygwin-patches mailing list