Fix off-by-one buffer overrun in get_exe_dir
Found by coverity
This commit is contained in:
parent
b2f5b44b19
commit
855d8116d1
1 changed files with 1 additions and 1 deletions
|
@ -455,7 +455,7 @@ std::string get_exe_dir()
|
|||
{
|
||||
#ifndef _WIN32
|
||||
char buf[1024];
|
||||
size_t path_size = readlink("/proc/self/exe", buf, 1024);
|
||||
size_t path_size = readlink("/proc/self/exe", buf, sizeof(buf)-1);
|
||||
if(path_size == static_cast<size_t>(-1))
|
||||
return std::string();
|
||||
buf[path_size] = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue