The amd_map_program knob can potentially contain a command whose output

is then used as an argument to the amd program. This outpu may contain
newlines, but the script did not take care to strip those newlines before
apending it to rc_flags. Revision 1.72 of rc.subr(8) introduced changes that
exposed this problem (specifically putting the final eval'ed command in
quotes).[1]

Also, for correctness' sake, shell directives appended to the command-line
by the script should go into command_args, and not appended directly
to rc_flags.

Reported by:	John E Hein <jhein@timing.com> [1]
Tested by:	John E Hein <jhein@timing.com>
MFC after:	1 week
This commit is contained in:
Mike Makonnen 2007-10-19 22:55:42 +00:00
parent c577b8012e
commit 1131159255
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=172822

View File

@ -34,7 +34,7 @@ amd_precmd()
[Nn][Oo] | '')
;;
*)
rc_flags="${rc_flags} `eval ${amd_map_program}`"
rc_flags="${rc_flags} `echo $(eval ${amd_map_program})`"
;;
esac
@ -46,7 +46,8 @@ amd_precmd()
fi
;;
*)
rc_flags="-p ${rc_flags} > /var/run/amd.pid 2> /dev/null"
rc_flags="-p ${rc_flags}"
command_args=" > /var/run/amd.pid 2> /dev/null"
;;
esac
return 0