diff --git a/onnxruntime/core/platform/android/cxa_demangle.cc b/onnxruntime/core/platform/android/cxa_demangle.cc index 9fe4bb674e..ebeca2b03c 100644 --- a/onnxruntime/core/platform/android/cxa_demangle.cc +++ b/onnxruntime/core/platform/android/cxa_demangle.cc @@ -52,10 +52,9 @@ char* __cxa_demangle(const char* mangled_name, char* buf, size_t* n, int* status if (!initialize_output_buffer(buf, n, buf_size, 1024)) { internal_status = DEMANGLE_MEMORY_ALLOCATION_FAILURE; } else { + // This might cause a truncated mangled name being returned without error, + // but should be fine for debugging purpose. strncpy(buf, mangled_name, buf_size); - // Blindly guard the output buffer, this might cause a truncated mangled name being returned without error status, - // but this should be fine for debugging purpose. As we are returning the mangle name directly, if the caller is - // doing crazy stuff with the name, it should both fail with the return mangled name and a truncated mangled name. buf[buf_size - 1] = '\0'; }