Initialize buffer for retrieved path

This avoids a warning on GCC 11.

Fixes #369
This commit is contained in:
Benny Baumann 2020-12-06 11:51:03 +01:00
parent 4c4ba9d949
commit 22f8f8000c

View File

@ -883,7 +883,7 @@ static void LinuxProcessList_readSecattrData(LinuxProcess* process, openat_arg_t
}
static void LinuxProcessList_readCwd(LinuxProcess* process, openat_arg_t procFd) {
char pathBuffer[PATH_MAX + 1];
char pathBuffer[PATH_MAX + 1] = {0};
#if defined(HAVE_READLINKAT) && defined(HAVE_OPENAT)
ssize_t r = readlinkat(procFd, "cwd", pathBuffer, sizeof(pathBuffer) - 1);
@ -892,6 +892,7 @@ static void LinuxProcessList_readCwd(LinuxProcess* process, openat_arg_t procFd)
xSnprintf(filename, sizeof(filename), "%s/cwd", procFd);
ssize_t r = readlink(filename, pathBuffer, sizeof(pathBuffer) - 1);
#endif
if (r < 0) {
free(process->cwd);
process->cwd = NULL;