summaryrefslogtreecommitdiffstats
path: root/Source/cmStringCommand.cxx
diff options
context:
space:
mode:
authorSean McBride <sean@rogue-research.com>2022-06-17 23:57:11 (GMT)
committerBrad King <brad.king@kitware.com>2022-06-22 12:59:40 (GMT)
commitd5694e46233aa7173134fc3952b5f25a7e0b0f58 (patch)
tree4345562d4404fc697170e23485d6d650f6798699 /Source/cmStringCommand.cxx
parenteccd0b92b6463f86ca010b6a256a4448bb378549 (diff)
downloadCMake-d5694e46233aa7173134fc3952b5f25a7e0b0f58.zip
CMake-d5694e46233aa7173134fc3952b5f25a7e0b0f58.tar.gz
CMake-d5694e46233aa7173134fc3952b5f25a7e0b0f58.tar.bz2
Source: Replace uses of sprintf with safer snprintf
Diffstat (limited to 'Source/cmStringCommand.cxx')
-rw-r--r--Source/cmStringCommand.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index c3ee695..fe311d1 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -143,7 +143,8 @@ bool HandleHexCommand(std::vector<std::string> const& args,
std::string::size_type hexIndex = 0;
for (auto const& c : instr) {
- sprintf(&output[hexIndex], "%.2x", static_cast<unsigned char>(c) & 0xFF);
+ snprintf(&output[hexIndex], 3, "%.2x",
+ static_cast<unsigned char>(c) & 0xFF);
hexIndex += 2;
}