Fix insecure library loading (Debian Bug #598309, CVE-2010-3386) (v2)
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 30 Sep 2010 14:49:05 +0000 (16:49 +0200)
committerNils Carlson <nils.carlson@ericsson.com>
Fri, 1 Oct 2010 12:41:53 +0000 (14:41 +0200)
Thanks to Raphael Geissert for spotting this, and to Jon Bernard for forwarding
the information to us.

Changelog since v1:
Apply comments from Nils.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Nils Carlson <nils.carlson@ericsson.com>
CC: Raphael Geissert <geissert@debian.org>
CC: Jon Bernard <jbernard@debian.org>
usttrace

index dc159f2cdff33897876b9b793bc9474ccc6c5ab7..5fdb52f3e88e7fdabb2d6e55bd0c537b706841fe 100755 (executable)
--- a/usttrace
+++ b/usttrace
@@ -132,27 +132,54 @@ fi
 
     if [ "$arg_preload_libust" = "1" ];
     then
-       if [ -n "${LIBUST_PATH%libust.so}" ] ; then
-           export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${LIBUST_PATH%libust.so}"
+       if [ -n "${LIBUST_PATH%libust.so}" ];
+       then
+               if [ -n "$LD_LIBRARY_PATH" ];
+               then
+                       export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${LIBUST_PATH%libust.so}"
+               else
+                       export LD_LIBRARY_PATH="${LIBUST_PATH%libust.so}"
+               fi
+       fi
+       if [ -n "$LIBUST_PATH" ];
+       then
+               if [ -n "$LD_PRELOAD" ];
+               then
+                       export LD_PRELOAD="$LD_PRELOAD:$LIBUST_PATH"
+               else
+                       export LD_PRELOAD="$LIBUST_PATH"
+               fi
        fi
-       export LD_PRELOAD="$LD_PRELOAD:$LIBUST_PATH"
     fi
 
-    if [ "$arg_ld_std_ust" = "1" ];
+    if [ "$arg_ld_std_ust" = "1" ] && [ -n "${LIBUST_PATH%libust.so}" ];
     then
-       if [ -n "$${LIBUST_PATH%libust.so}" ] ; then
-           export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${LIBUST_PATH%libust.so}"
+       if [ -n "$LD_LIBRARY_PATH" ];
+       then
+               export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${LIBUST_PATH%libust.so}"
+       else
+               export LD_LIBRARY_PATH="${LIBUST_PATH%libust.so}"
        fi
     fi
 
-    if [ "$arg_preload_malloc" = "1" ];
+    if [ "$arg_preload_malloc" = "1" ] && [ -n "$LIBMALLOCWRAP_PATH" ];
     then
-       export LD_PRELOAD="$LD_PRELOAD:$LIBMALLOCWRAP_PATH"
+       if [ -n "$LD_PRELOAD" ];
+       then
+               export LD_PRELOAD="$LD_PRELOAD:$LIBMALLOCWRAP_PATH"
+       else
+               export LD_PRELOAD="$LIBMALLOCWRAP_PATH"
+       fi
     fi
 
-    if [ "$arg_preload_fork" = "1" ];
+    if [ "$arg_preload_fork" = "1" ] && [ -n "$LIBINTERFORK_PATH" ];
     then
-       export LD_PRELOAD="$LD_PRELOAD:$LIBINTERFORK_PATH"
+       if [ -n "$LD_PRELOAD" ];
+       then
+               export LD_PRELOAD="$LD_PRELOAD:$LIBINTERFORK_PATH"
+       else
+               export LD_PRELOAD="$LIBINTERFORK_PATH"
+       fi
     fi
 
 # Execute the command
This page took 0.034677 seconds and 4 git commands to generate.