diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index fb1bdb65d..802855c09 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -180,8 +180,8 @@ public: { cmStrStreamCleanup cleanup(*this); cmStrStreamCleanup::IgnoreUnusedVariable(cleanup); - const char* ptr = this->Superclass::str(); - return std::string(ptr, ptr+this->pcount()); + int pcount = this->pcount(); + return std::string(this->Superclass::str(), pcount); } private: cmStringStream(const cmStringStream&);