Skip to content

Commit 2e97c38

Browse files
committed
Avoid off-by-one error when using readlink
1 parent 40ddc3d commit 2e97c38

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

port/stack_trace.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const char* GetExecutableName() {
3333

3434
char link[1024];
3535
snprintf(link, sizeof(link), "/proc/%d/exe", getpid());
36-
auto read = readlink(link, name, sizeof(name));
36+
auto read = readlink(link, name, sizeof(name) - 1);
3737
if (-1 == read) {
3838
return nullptr;
3939
} else {

0 commit comments

Comments
 (0)