Bugfix: sizeof(destpath)-1 to have space for the trailing NUL (Thanks Merovius)

next
Michael Stapelberg 2013-06-10 23:08:17 +02:00
parent d51173b2ba
commit 3930615104
1 changed files with 1 additions and 1 deletions

View File

@ -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';