From 1131159255b5ea6fdb7b67d71aab0095e5fe9c10 Mon Sep 17 00:00:00 2001 From: Mike Makonnen Date: Fri, 19 Oct 2007 22:55:42 +0000 Subject: [PATCH] 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 [1] Tested by: John E Hein MFC after: 1 week --- etc/rc.d/amd | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/rc.d/amd b/etc/rc.d/amd index 8c3e85f7dd26..040e5ffcd424 100755 --- a/etc/rc.d/amd +++ b/etc/rc.d/amd @@ -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