liangfu commented on a change in pull request #7190:
URL: https://github.com/apache/tvm/pull/7190#discussion_r551175687



##########
File path: src/runtime/crt/common/crt_runtime_api.c
##########
@@ -38,7 +38,10 @@
 
 static char g_last_error[1024];
 
-void TVMAPISetLastError(const char* msg) { strncpy(g_last_error, msg, 
sizeof(g_last_error)); }
+void TVMAPISetLastError(const char* msg) {
+  strncpy(g_last_error, msg, sizeof(g_last_error) - 1);
+  g_last_error[sizeof(g_last_error) - 1] = 0;

Review comment:
       Good point. On a second thought, the proposed change is good enough to 
put msg to g_last_error.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to