--- ifupdown-scripts-zg2-0.3.orig/scripts/ifupdown-scripts-zg2.d/common-functions
+++ ifupdown-scripts-zg2-0.3/scripts/ifupdown-scripts-zg2.d/common-functions
@@ -1,6 +1,8 @@
 #!/bin/bash
 # $Header$
 
+export LC_ALL=C
+
 # set global vars, make statefile existent, and do basic sanity checks
 
 VERBOSE=${IF_VERBOSE:-}
@@ -349,11 +351,16 @@
 
 # it is possible that /usr is not yet mounted, we try to get by without /usr
 PATH="/sbin:/bin"
-STATEDIR="/etc/network/run/ifupdown-scripts-zg2"
+NWSTATE="/etc/network/run"
+STATEDIR="$NWSTATE/ifupdown-scripts-zg2"
 STATEFILE="$STATEDIR/$IFACE.state"
 
-# we assume that $STATEDIR's parents were created in a secure manner and
-# that noone but root can write there
+# check that noone but root can write to $NWSTATE
+
+if ! ls -nd $(readlink --canonicalize "$NWSTATE") | grep -q -- '^d....-..-. [[:digit:]]\+ 0 0 '; then
+  abort "$NWSTATE is not (or does not point to) a directory, or is writeable by non-root user"
+fi
+
 if ! [ -e "$STATEFILE" ]; then
   umask 022
   if ! mkdir -p $STATEDIR; then
