From 5254c96d39dce8914aedb95ffee202c41a6feb86 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Wed, 3 Nov 2021 12:08:43 -0500 Subject: [PATCH 1/2] set the last byte in allocated char array to zero. (#650) --- dpctl-capi/helper/include/dpctl_string_utils.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dpctl-capi/helper/include/dpctl_string_utils.hpp b/dpctl-capi/helper/include/dpctl_string_utils.hpp index 3b1d0ae73c..aa1a8a9535 100644 --- a/dpctl-capi/helper/include/dpctl_string_utils.hpp +++ b/dpctl-capi/helper/include/dpctl_string_utils.hpp @@ -50,6 +50,11 @@ cstring_from_string(const std::string &str) #else std::strncpy(cstr, str.c_str(), cstr_len); #endif + // Added to resolve CheckMarx's false positive. + // NB: This is redundant because str.c_str() is guaranteed + // to be null-terminated and the copy function is asked to + // copy enough characters to include that null-character. + cstr[cstr_len - 1] = '\0'; } catch (std::bad_alloc const &ba) { // \todo log error std::cerr << ba.what() << '\n'; From 4cf2b200a585c2f5cf51c140ca424d380d775a70 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Tue, 30 Nov 2021 18:15:28 +0300 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e1c4bc9f8..e0a3ea002c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,12 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.11.3] - 11/30/2021 + +### Fixed + +* Set the last byte in allocated char array to zero [cherry picked from #650] (#699) + ## [0.11.2] - 11/29/2021 ### Added - Extending `dpctl.device_context` with nested contexts (#678) -## Fixed +### Fixed - Fixed issue #649 about incorrect behavior of `.T` method on sliced arrays (#653) ## [0.11.1] - 11/10/2021