The mentioned function allocates and copies elements
of size 1. Therefore, the implementation was simplified
and additional check was added to avoid possible UBs.
Signed-off-by: Wrobel, Patryk <patryk.wrobel@intel.com>
This change:
- prevents writing memory out of the range of the destination buffer
- prevents calling strlen() with non-null terminated c-string
- corrects the logic, which validates passed range to proceed
when real length fits the destination buffer
Related-To: NEO-7264
Signed-off-by: Wrobel, Patryk <patryk.wrobel@intel.com>
Dates corrected in copyright headers to reflect original publication date
(2018 for OpenCL, 2020 for Level Zero).
Signed-off-by: lgotszal <lukasz.gotszald@intel.com>