Fix buffer overflow when parsing kernel cmdline (#1133)

[ROCm/rccl commit: 137571fa01]
이 커밋은 다음에 포함됨:
Wenkai Du 작성하고 GitHub가 2024-04-08 11:12:20 -07:00를 커밋함
1 부모 62b9f0d3a7
커밋 0941d6bc6e
1 파일이 변경됨
+2 -2
+2 -2
파일 보기
@@ -109,7 +109,7 @@ static ncclResult_t ncclInit() {
NCCLCHECK(bootstrapNetInit());
NCCLCHECK(ncclNetPluginInit());
char strValue[1024];
char strValue[2048];
NCCLCHECK(ncclTopoGetStrFromSys("/proc/sys/kernel", "numa_balancing", strValue));
if (strcmp(strValue, "1") == 0)
WARN("NUMA auto balancing enabled which can lead to variability in the RCCL performance! Disable by \"sudo sysctl kernel.numa_balancing=0\"");
@@ -127,7 +127,7 @@ static ncclResult_t ncclInit() {
FILE* file;
if ((file = fopen("/proc/cmdline", "r")) != NULL) {
if (feof(file) == 0 && ferror(file) == 0) {
int len = fread(strValue, 1, 1024, file);
int len = fread(strValue, 1, 2047, file);
strValue[len] = '\0';
}
fclose(file);