Prevent stack buffer overflow
readlink() does not append a null byte to buffer. Initialize the
tpath to prevent stack buffer overflow.
Change-Id: I17895dc3576b080a0c35bd0528a5b83223ec1c1b
[ROCm/amdsmi commit: 4b65b0307f]
This commit is contained in:
gecommit door
Shuzhou Liu
bovenliggende
e8ea51109b
commit
ef0b0eb0af
@@ -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);
|
||||
|
||||
|
||||
Verwijs in nieuw issue
Block a user