Prevent stack buffer overflow

readlink() does not append a null byte to buffer. Initialize the
tpath to prevent stack buffer overflow.

Change-Id: I17895dc3576b080a0c35bd0528a5b83223ec1c1b
이 커밋은 다음에 포함됨:
Bill(Shuzhou) Liu 작성하고 Shuzhou Liu가 2022-03-03 15:43:53 -05:00를 커밋함
1 부모 3a3b8dd25d
커밋 4b65b0307f
1 파일이 변경됨
+1
+1
파일 보기
@@ -183,6 +183,7 @@ static uint32_t ConstructBDFID(std::string path, uint64_t *bdfid) {
assert(bdfid != nullptr);
char tpath[256];
ssize_t ret;
memset(tpath,0,256);
ret = readlink(path.c_str(), tpath, 256);