Merge topic 'ctest_update-memory-problems'

27f033550a ctest_update: Fix crash when handling svn externals
75e8af3354 cmSystemTools: Fix ParseArguments out-of-bounds read

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1893
This commit is contained in:
Brad King
2018-03-28 11:23:14 +00:00
committed by Kitware Robot
2 changed files with 10 additions and 7 deletions

View File

@@ -8,6 +8,7 @@
#include "cmCTestGlobalVC.h"
#include <iosfwd>
#include <list>
#include <string>
#include <vector>
@@ -70,7 +71,8 @@ private:
friend struct Revision;
// Info of all the repositories (root, externals and nested ones).
std::vector<SVNInfo> Repositories;
// Use std::list so the elements don't move in memory.
std::list<SVNInfo> Repositories;
// Pointer to the infos of the root repository.
SVNInfo* RootInfo;

View File

@@ -550,12 +550,13 @@ std::vector<std::string> cmSystemTools::ParseArguments(const char* command)
bool win_path = false;
if ((command[0] != '/' && command[1] == ':' && command[2] == '\\') ||
(command[0] == '\"' && command[1] != '/' && command[2] == ':' &&
command[3] == '\\') ||
(command[0] == '\'' && command[1] != '/' && command[2] == ':' &&
command[3] == '\\') ||
(command[0] == '\\' && command[1] == '\\')) {
if (command[0] && command[1] &&
((command[0] != '/' && command[1] == ':' && command[2] == '\\') ||
(command[0] == '\"' && command[1] != '/' && command[2] == ':' &&
command[3] == '\\') ||
(command[0] == '\'' && command[1] != '/' && command[2] == ':' &&
command[3] == '\\') ||
(command[0] == '\\' && command[1] == '\\'))) {
win_path = true;
}
// Split the command into an argv array.