Fixed segfault in pidof when the -f (format) flag is used with

crafted format strings.
Avoid printing stack memory when special format string is passed
to -f.
Listed control characters for -f flag in manual page.
This commit is contained in:
Jesse Smith
2019-03-18 18:09:24 -03:00
parent e19b991bb0
commit 4e2ad6a698
3 changed files with 84 additions and 2 deletions

View File

@@ -69,8 +69,10 @@ Tells \fIpidof\fP to omit processes with that process id. The special
pid \fB%PPID\fP can be used to name the parent process of the \fIpidof\fP
program, in other words the calling shell or shell script.
.IP "-f \fIformat\fP"
Tells \fIpidof\fP to format the process ids in the given \fIprintf\fP style.
Tells \fIpidof\fP to format the process IDs in the given \fIprintf\fP style string.
For example \fB" -p%d"\fP is useful for \fIstrace\fP.
The "%d" symbol is used as a place holder for the PID to be printed. A "\\n" can
be used to cause a newline to be printed. For example \fB" %d\\n"\fP.
.SH "EXIT STATUS"
.TP
.B 0