pgrep: fix -x option
Because when -x is used (exact match), then we cannot compile the regular expression with REG_NOSUB. The manual page regcomp(3) states in section "Byte offsets": Unless REG_NOSUB was set for the compilation of the pattern buffer, it is possible to obtain substring match addressing information. The problem was detected on an ARM system with glibc 2.16. Signed-off-by: Bernhard Walle <bernhard@bwalle.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
ed954b6855
commit
47f8558eee
@ -128,7 +128,7 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
|
|
||||||
if (argv[0])
|
if (argv[0])
|
||||||
xregcomp(&re_buffer, argv[0], REG_EXTENDED | REG_NOSUB);
|
xregcomp(&re_buffer, argv[0], OPT_ANCHOR ? REG_EXTENDED : (REG_EXTENDED|REG_NOSUB);
|
||||||
|
|
||||||
matched_pid = 0;
|
matched_pid = 0;
|
||||||
cmd_last = NULL;
|
cmd_last = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user