From f2f7f03d617d7143d375869596bcb208ab1a072d Mon Sep 17 00:00:00 2001 From: Ashutosh Mishra Date: Mon, 25 Aug 2025 09:41:25 +0530 Subject: [PATCH] Fix buffer overrun (#655) Assigning a null terminator at the end of the string wrote past the end of the allocated buffer. This patch corrects that. Signed-off-by: Ashutosh Mishra --- projects/rocm-core/rocm_version.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/projects/rocm-core/rocm_version.cpp b/projects/rocm-core/rocm_version.cpp index e8ac822258..41b8039f93 100644 --- a/projects/rocm-core/rocm_version.cpp +++ b/projects/rocm-core/rocm_version.cpp @@ -48,9 +48,7 @@ static VerErrors getBuildInfo( char* InfoString, int len ) { NULL_CHECK(InfoString); #if defined(ROCM_BUILD_INFO) - - strcpy(InfoString,ROCM_BUILD_INFO); - InfoString[len]='\0'; + snprintf(InfoString, len, "%s", ROCM_BUILD_INFO); #else return VerValuesNotDefined; #endif //end defination checker