Skip to content

Commit

Permalink
Avoid off-by-one error when using readlink
Browse files Browse the repository at this point in the history
  • Loading branch information
nbougalis committed Sep 6, 2014
1 parent 40ddc3d commit 2e97c38
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion port/stack_trace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2e97c38

Please sign in to comment.