Fixed memory initialization error in pidof. Fix provided by Markus Fischer.

This commit is contained in:
Jesse 2023-03-24 11:18:02 -03:00
parent b70b2776ed
commit b6aacf3b68
2 changed files with 2 additions and 0 deletions

View File

@ -7,6 +7,7 @@ sysvinit (3.07) released; urgency=low
This is now fixed as we check both the realpath and symbolic path for processes. This is now fixed as we check both the realpath and symbolic path for processes.
In other words, "pidof /tmp/sleep" and "pidof /usr/bin/sleep" will return In other words, "pidof /tmp/sleep" and "pidof /usr/bin/sleep" will return
the same PIDs when /tmp/sleep is a symbolic link to /usr/bin/sleep. the same PIDs when /tmp/sleep is a symbolic link to /usr/bin/sleep.
* Fixed memory initialization error in pidof. Fix provided by Markus Fischer.
sysvinit (3.06) released; urgency=low sysvinit (3.06) released; urgency=low

View File

@ -662,6 +662,7 @@ int readproc()
/* Try to stat the executable. */ /* Try to stat the executable. */
snprintf(path, sizeof(path), "/proc/%s/exe", d->d_name); snprintf(path, sizeof(path), "/proc/%s/exe", d->d_name);
p->pathname = (char *)xmalloc(PATH_MAX); p->pathname = (char *)xmalloc(PATH_MAX);
memset(p->pathname, 0, PATH_MAX);
if (readlink(path, p->pathname, PATH_MAX) == -1) { if (readlink(path, p->pathname, PATH_MAX) == -1) {
p->pathname = NULL; p->pathname = NULL;
} }