From 5a0fdd353715ffdededd32640997d07152eec3aa Mon Sep 17 00:00:00 2001 From: KnightYao Date: Sat, 21 Nov 2020 06:15:22 +0800 Subject: [PATCH] Update custom_ops.cc (#5507) To fix KernelInfoGetAttrbute_string get string will lose the laster char --- onnxruntime/core/session/custom_ops.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onnxruntime/core/session/custom_ops.cc b/onnxruntime/core/session/custom_ops.cc index 598c8e7bf8..57826892a6 100644 --- a/onnxruntime/core/session/custom_ops.cc +++ b/onnxruntime/core/session/custom_ops.cc @@ -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;