fix off by 1 error

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2023-02-19 14:41:38 -08:00
parent 3426eaaadf
commit f2c879333e

View File

@ -164,7 +164,7 @@ static std::vector<std::string> getLoadedLibraries() {
char procsz[100];
char pathsz[500];
snprintf(procsz, sizeof(procsz), "/proc/%d/path/a.out", getpid());
int l = readlink(procsz, pathsz, sizeof(pathsz));
int l = readlink(procsz, pathsz, sizeof(pathsz) - 1);
if (l > 0) {
pathsz[l] = '\0';
path.assign(pathsz);