Avoid off-by-one error when using readlink

This commit is contained in:
Nik Bougalis 2014-09-04 23:11:28 -07:00
parent 40ddc3d6c4
commit 2e97c38980
1 changed files with 1 additions and 1 deletions

View File

@ -33,7 +33,7 @@ const char* GetExecutableName() {
char link[1024];
snprintf(link, sizeof(link), "/proc/%d/exe", getpid());
auto read = readlink(link, name, sizeof(name));
auto read = readlink(link, name, sizeof(name) - 1);
if (-1 == read) {
return nullptr;
} else {