From 7e5509a260a3573d817d6095dc21d40a94fc9fa8 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 20 Jun 2006 13:13:13 -0400 Subject: ENH: avoid crash in sprintf --- Source/MFCDialog/CMakeSetupDialog.cpp | 3 ++- Source/cmake.cxx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp index 534f713..0a605f2 100644 --- a/Source/MFCDialog/CMakeSetupDialog.cpp +++ b/Source/MFCDialog/CMakeSetupDialog.cpp @@ -83,7 +83,7 @@ void MFCMessageCallback(const char* m, const char* title, bool& nomore, void*) // CMakeSetupDialog dialog void updateProgress(const char *msg, float prog, void *cd) { - char tmp[1024]; + char* tmp = new char[strlen(msg) + 40]; if (prog >= 0) { sprintf(tmp,"%s %i%%",msg,(int)(100*prog)); @@ -120,6 +120,7 @@ void updateProgress(const char *msg, float prog, void *cd) break; } } + delete [] tmp; } // Convert to Win32 path (slashes). This calls the system tools one and then diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 44efd23..2f4100f 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2369,7 +2369,7 @@ void cmake::GenerateGraphViz(const char* fileName) std::map targetDeps; std::map targetPtrs; std::map targetNamesNodes; - char tgtName[100]; + char tgtName[2048]; int cnt = 0; // First pass get the list of all cmake targets for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit ) -- cgit v0.12