IFS pollution from localpkg

Mike Makonnen mtm at identd.net
Sun Oct 3 02:19:27 PDT 2004


On Sat, Oct 02, 2004 at 03:18:52PM -0700, Doug White wrote:
> I guess no one changes the script_name_sep rc.conf variable to something
> more dangerous than the default space...
> 
> Anyway, I think we should investigate running local package scripts with
> IFS (and other hazardous variables) stripped using env. Or perhaps not
> play with IFS at all unless the user sets script_name_sep, and change the
> default accordingly.
> 
> I'm not sure why this doesn't mess more stuff up :-/

It looks like this particular bug has been around since that feature
was introduced in rev. 1.272 way back in July 2001. I guess people don't
use it that much.

Does the following patch fix your problem?

Cheers.
-- 
Mike Makonnen  | GPG-KEY: http://www.identd.net/~mtm/mtm.asc
mtm at identd.net | Fingerprint: AC7B 5672 2D11 F4D0 EBF8  5279 5359 2B82 7CD4 1F55
mtm at FreeBSD.Org| FreeBSD - Unleash the Daemon !
-------------- next part --------------
Index: etc/rc.d/localpkg
===================================================================
RCS file: /home/ncvs/src/etc/rc.d/localpkg,v
retrieving revision 1.4
diff -u -r1.4 localpkg
--- etc/rc.d/localpkg	28 Jul 2004 00:09:18 -0000	1.4
+++ etc/rc.d/localpkg	3 Oct 2004 09:12:25 -0000
@@ -40,7 +40,7 @@
 			if [ -x "${script}" ]; then
 				(set -T
 				trap 'exit 1' 2
-				${script} start)
+				/bin/env IFS="${script_save_sep}" ${script} start)
 			elif [ -f "${script}" -o -L "${script}" ]; then
 				echo -n " (skipping ${script##*/}, not executable)"
 			fi
@@ -77,7 +77,7 @@
 			if [ -x "${script}" ]; then
 				(set -T
 				trap 'exit 1' 2
-				${script} stop)
+				/bin/env IFS="${script_save_sep}" ${script} stop)
 			fi
 		done
 		IFS="${script_save_sep}"


More information about the freebsd-current mailing list