mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
Merge topic 'project-version-buffer-overflow'
82cdb26c93project: Fix potential buffer write-past-end for version components15a0b0d046Help: math() expressions must be representable as signed 64-bit Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3948
This commit is contained in:
@@ -229,7 +229,8 @@ bool cmProjectCommand(std::vector<std::string> const& args,
|
||||
std::array<std::string, MAX_VERSION_COMPONENTS> version_components;
|
||||
|
||||
if (cmp0096 == cmPolicies::OLD || cmp0096 == cmPolicies::WARN) {
|
||||
char vb[MAX_VERSION_COMPONENTS][std::numeric_limits<unsigned>::digits10];
|
||||
char vb[MAX_VERSION_COMPONENTS]
|
||||
[std::numeric_limits<unsigned>::digits10 + 2];
|
||||
unsigned v[MAX_VERSION_COMPONENTS] = { 0, 0, 0, 0 };
|
||||
const int vc = std::sscanf(version.c_str(), "%u.%u.%u.%u", &v[0], &v[1],
|
||||
&v[2], &v[3]);
|
||||
|
||||
Reference in New Issue
Block a user