Bugfix: sizeof(destpath)-1 to have space for the trailing NUL (Thanks Merovius)
This commit is contained in:
parent
d51173b2ba
commit
3930615104
|
@ -25,7 +25,7 @@ const char *get_exe_path(const char *argv0) {
|
|||
#endif
|
||||
ssize_t linksize;
|
||||
|
||||
if ((linksize = readlink(exepath, destpath, sizeof(destpath))) != -1) {
|
||||
if ((linksize = readlink(exepath, destpath, sizeof(destpath) - 1)) != -1) {
|
||||
/* readlink() does not NULL-terminate strings, so we have to. */
|
||||
destpath[linksize] = '\0';
|
||||
|
||||
|
|
Loading…
Reference in New Issue