Update custom_ops.cc (#5507)

To fix KernelInfoGetAttrbute_string get string will lose the laster char
This commit is contained in:
KnightYao 2020-11-21 06:15:22 +08:00 committed by GitHub
parent ceedf5630b
commit 5a0fdd3537
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,7 +57,7 @@ ORT_API_STATUS_IMPL(OrtApis::KernelInfoGetAttribute_string, _In_ const OrtKernel
if (*size >= value.size() + 1) {
std::memcpy(out, value.data(), value.size());
out[value.size()] = '\0';
*size = value.size();
*size = value.size() + 1;
return nullptr;
} else {
*size = value.size() + 1;