From 24a13ab6892d7f44ec0e1f0de53b364cc334d617 Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Sun, 11 Sep 2005 09:19:24 +0000 Subject: [PATCH] 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. svn path=/trunk/; revision=17793 --- reactos/tools/rbuild/backend/mingw/mingw.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index 4c5d66ecd16..82cb11854e2 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -841,10 +841,13 @@ MingwBackend::GetBinutilsVersion ( const string& binutilsCommand ) 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 );