diff options
author | Sean McBride <sean@rogue-research.com> | 2021-10-21 16:35:57 (GMT) |
---|---|---|
committer | Sean McBride <sean@rogue-research.com> | 2021-10-25 22:23:13 (GMT) |
commit | 5ba6e8ac59333aa574d5963332e3ef0f4c4d3514 (patch) | |
tree | d796f695e10d5ec20508cb04f4c8b3c2a6c0d742 /Source/cmFileCommand.cxx | |
parent | 0ce50dd78f68b697e1ab29d52d733b87c5bfb67d (diff) | |
download | CMake-5ba6e8ac59333aa574d5963332e3ef0f4c4d3514.zip CMake-5ba6e8ac59333aa574d5963332e3ef0f4c4d3514.tar.gz CMake-5ba6e8ac59333aa574d5963332e3ef0f4c4d3514.tar.bz2 |
Source: Replace most calls to sprintf with snprintf
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index fd0595d..338f3c9 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -217,7 +217,7 @@ bool HandleReadCommand(std::vector<std::string> const& args, char c; while ((sizeLimit != 0) && (file.get(c))) { char hex[4]; - sprintf(hex, "%.2x", c & 0xff); + snprintf(hex, sizeof(hex), "%.2x", c & 0xff); output += hex; if (sizeLimit > 0) { sizeLimit--; @@ -1627,8 +1627,9 @@ size_t cmFileCommandCurlDebugCallback(CURL*, curl_infotype type, char* chPtr, case CURLINFO_SSL_DATA_IN: case CURLINFO_SSL_DATA_OUT: { char buf[128]; - int n = sprintf(buf, "[%" KWIML_INT_PRIu64 " bytes data]\n", - static_cast<KWIML_INT_uint64_t>(size)); + int n = + snprintf(buf, sizeof(buf), "[%" KWIML_INT_PRIu64 " bytes data]\n", + static_cast<KWIML_INT_uint64_t>(size)); if (n > 0) { cm::append(vec, buf, buf + n); } |