mirror of
https://github.com/sheumann/hush.git
synced 2024-12-21 23:29:34 +00:00
pgrep: match argv[0] too, not only comm; fix a bug in argv sanitization
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
5da42fce51
commit
16d1e3c26f
@ -92,7 +92,7 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
if (sid2match == 0)
|
if (sid2match == 0)
|
||||||
sid2match = getsid(pid);
|
sid2match = getsid(pid);
|
||||||
|
|
||||||
scan_mask = PSSCAN_COMM;
|
scan_mask = PSSCAN_COMM | PSSCAN_ARGV0;
|
||||||
if (OPT_FULL)
|
if (OPT_FULL)
|
||||||
scan_mask |= PSSCAN_ARGVN;
|
scan_mask |= PSSCAN_ARGVN;
|
||||||
|
|
||||||
@ -117,9 +117,9 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
cmd = proc->comm;
|
cmd = proc->comm;
|
||||||
} else {
|
} else {
|
||||||
int i = proc->argv_len;
|
int i = proc->argv_len;
|
||||||
while (i) {
|
while (--i >= 0) {
|
||||||
if (!cmd[i]) cmd[i] = ' ';
|
if ((unsigned char)cmd[i] < ' ')
|
||||||
i--;
|
cmd[i] = ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user