### Eclipse Workspace Patch 1.0
#P VTK
Index: IO/vtkXMLShader.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/IO/vtkXMLShader.cxx,v
retrieving revision 1.7
diff -u -r1.7 vtkXMLShader.cxx
--- IO/vtkXMLShader.cxx	22 Mar 2006 08:25:20 -0000	1.7
+++ IO/vtkXMLShader.cxx	30 Mar 2007 01:33:28 -0000
@@ -165,9 +165,16 @@
   // Allocate for the file and the null terminator.
   this->Code = new char[length+1];
   ifp.read(this->Code, length);
+
+  // See how many characters were actually read. On Windows, CRLF line endings
+  // are read as a single char, so the number of read bytes will be less than
+  // the number of bytes reported in the file size query above.
+  int charsRead = ifp.gcount();
+
   ifp.close();
+  
   // Null terminate the string so GL doesn't get confused.
-  this->Code[length] = '\0';
+  this->Code[charsRead] = '\0';
 }
 //-----------------------------------------------------------------------------
 int vtkXMLShader::GetLanguage()
