================
@@ -1441,6 +1531,9 @@ void OverlapStats::dump(raw_fd_ostream &OS) const {
     case IPVK_MemOPSize:
       strncpy(ProfileKindName, "MemOP", 19);
       break;
+    case IPVK_VTableTarget:
+      strncpy(ProfileKindName, "VTable", 6);
----------------
snehasish wrote:

I think this usage of strncpy is incorrect. It will not copy the null 
terminator from the "VTable" const char * since the null terminator is the 7th 
char. Since ProfileKindName is uninitialized it could lead to issues when 
reading it.

The existing code should initialize `ProfileKindName[20] = {0}` and then the 
value of 19 used above makes sense. It will attempt to copy 19 chars unless it 
encounters the null char in which case the rest will be padded. What do you 
think?

https://github.com/llvm/llvm-project/pull/66825
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to