]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-* tools are vulnerable for arguments with spaces
authorMichel Normand <michel.mno@free.fr>
Tue, 15 Mar 2011 19:19:07 +0000 (20:19 +0100)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Tue, 22 Mar 2011 14:17:21 +0000 (15:17 +0100)
this is related to the bug
http://sourceforge.net/tracker/?func=detail&aid=3113612&group_id=163076&atid=826303
that suggested to modify bash lxc script to properly use "$@" in place of "$*"

Signed-off-by: Michel Normand <michel.mno@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/lxc-ls.in
src/lxc/lxc-netstat.in
src/lxc/lxc-setcap.in
src/lxc/lxc-setuid.in

index 7d2dad034ffaa4ed34a8d5367a59a2863462c340..3cd7c24e882c57c4bd4c1fc723ed7e7ddbf4ffc3 100644 (file)
@@ -18,7 +18,7 @@ function get_cgroup()
        fi
 }
 
-ls $* $lxcpath
+ls "$@" $lxcpath
 
 active=$(netstat -xa | grep $lxcpath | \
        sed -e 's#.*'"$lxcpath/"'\(.*\)/command#\1#');
@@ -26,6 +26,6 @@ active=$(netstat -xa | grep $lxcpath | \
 if test -n "$active"; then
        get_cgroup
        if test -n "$mount_point"; then
-               cd $mount_point; ls $* -d $active
+               cd $mount_point; ls "$@" -d $active
        fi
 fi
index 9d9f76741d6d9907a9959f5c22f077a782b7e924..9f3e9f3cfd91bea7d3af4f534e33a9e435846c41 100644 (file)
@@ -25,7 +25,7 @@ if [ $# -eq  0 ]; then
        exit 1
 fi
 
-for i in $*; do
+for i in "$@"; do
        case $i in
                -h|--help)
                        help; exit 1;;
@@ -37,7 +37,7 @@ for i in $*; do
 done
 
 if [ -z "$exec" ]; then
-    exec @BINDIR@/lxc-unshare -s MOUNT -- $0 -n $name --exec $*
+    exec @BINDIR@/lxc-unshare -s MOUNT -- $0 -n $name --exec "$@"
 fi
 
 if [ -z "$name" ]; then
@@ -72,4 +72,4 @@ if [ -z "$pid" ]; then
 fi
 
 mount --bind /proc/$pid/net /proc/$$/net && \
-    exec netstat $*
+    exec netstat "$@"
index cc719b584aa1cba78ca00db99f8de388cc747b7d..322676986e425f424d6817afeb990ed9ab94514d 100644 (file)
@@ -83,9 +83,9 @@ if [ $? != 0 ]; then
     exit 1
 fi
 
-set -- $(getopt dh $*)
+set -- $(getopt dh "$@")
 
-for i in $*; do
+for i in "$@"; do
     case "$1" in
        -d)
            LXC_DROP_CAPS="yes"
index 86d7d4a52efec73f225904460fbaab56a0789857..b1bbfff066cfbace4eb286a55bceafbd7f502130 100644 (file)
@@ -81,9 +81,9 @@ if [ $? != 0 ]; then
     exit 1
 fi
 
-set -- $(getopt dh $*)
+set -- $(getopt dh "$@")
 
-for i in $*; do
+for i in "$@"; do
     case "$1" in
        -d)
            LXC_DROP_CAPS="yes"
@@ -108,4 +108,4 @@ if [ -z "$LXC_DROP_CAPS" ]; then
     lxc_setuid
 else
     lxc_dropuid
-fi
\ No newline at end of file
+fi