diff options
author | Fujii Hironori <Hironori.Fujii@sony.com> | 2016-08-26 06:28:48 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-08-26 14:01:39 (GMT) |
commit | 1f4aeb1739fb632ab5162a977764b51736728edc (patch) | |
tree | 871851a67470c0c262ad82c5dfd2016507edd4a0 /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | f59513140bf086eda2029c5b4e950fc58216c06e (diff) | |
download | CMake-1f4aeb1739fb632ab5162a977764b51736728edc.zip CMake-1f4aeb1739fb632ab5162a977764b51736728edc.tar.gz CMake-1f4aeb1739fb632ab5162a977764b51736728edc.tar.bz2 |
VS: Fix out-of-bounds write on empty Nsight Tegra version
In cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator,
wrote 0 to this->NsightTegraVersion[-1] if sscanf returns -1 which is
the case of GetNsightTegraVersion is empty.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index fb05976..009f9a2 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -183,13 +183,12 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator( this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); this->Platform = gg->GetPlatformName(); this->NsightTegra = gg->IsNsightTegra(); - for (int i = - sscanf(gg->GetNsightTegraVersion().c_str(), "%u.%u.%u.%u", - &this->NsightTegraVersion[0], &this->NsightTegraVersion[1], - &this->NsightTegraVersion[2], &this->NsightTegraVersion[3]); - i < 4; ++i) { + for (int i = 0; i < 4; ++i) { this->NsightTegraVersion[i] = 0; } + sscanf(gg->GetNsightTegraVersion().c_str(), "%u.%u.%u.%u", + &this->NsightTegraVersion[0], &this->NsightTegraVersion[1], + &this->NsightTegraVersion[2], &this->NsightTegraVersion[3]); this->MSTools = !this->NsightTegra; this->TargetCompileAsWinRT = false; this->BuildFileStream = 0; |