We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 73ef7b8 commit 5b08d50Copy full SHA for 5b08d50
dpctl-capi/helper/include/dpctl_string_utils.hpp
@@ -50,6 +50,11 @@ cstring_from_string(const std::string &str)
50
#else
51
std::strncpy(cstr, str.c_str(), cstr_len);
52
#endif
53
+ // Added to resolve CheckMarx's false positive.
54
+ // NB: This is redundant because str.c_str() is guaranteed
55
+ // to be null-terminated and the copy function is asked to
56
+ // copy enough characters to include that null-character.
57
+ cstr[cstr_len - 1] = '\0';
58
} catch (std::bad_alloc const &ba) {
59
// \todo log error
60
std::cerr << ba.what() << '\n';
0 commit comments