[ros-diffs] [arty] 17793: Previously, the first character written to the buffer was random (off the

arty at svn.reactos.com arty at svn.reactos.com
Sun Sep 11 11:19:38 CEST 2005


Previously, the first character written to the buffer was random (off
the
stack).  Not sure why this didn't blow up for others.  Make sure we fill
one character before placing one in the buffer.
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
  _____  

Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-09-11
08:45:02 UTC (rev 17792)
+++ trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp	2005-09-11
09:19:24 UTC (rev 17793)
@@ -841,10 +841,13 @@

 	                                   NUL,
 	                                   NUL );
 	fp = popen ( versionCommand.c_str () , "r" );
-	for( i = 0; ( i < 80 ) && ( feof ( fp ) == 0 ); i++ )
+	for( i = 0; 
+             ( i < 80 ) && 
+                 ( feof ( fp ) == 0 && 
+                   ( ( ch = fgetc( fp ) ) != -1 ) ); 
+             i++ )
 	{
 		buffer[i] = (char) ch;
-		ch = fgetc( fp );
 	}
 	buffer[i] = '\0';
 	pclose ( fp );
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050911/153a8163/attachment.html


More information about the Ros-diffs mailing list