https://issues.apache.org/SpamAssassin/show_bug.cgi?id=7015

            Bug ID: 7015
           Summary: untaint_var() broken for undefined variables
           Product: Spamassassin
           Version: 3.4.0
          Hardware: PC
                OS: Windows 7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: spamc/spamd
          Assignee: [email protected]
          Reporter: [email protected]

>From Tomasz Potega:

I have run into some problems trying to upgrade to 3.4.0.

The '-x' ('--nouser-config') option of spamd doesn't seem to work
correctly.

Tracing the spamd child process I can see it tries to open a user_prefs
file of the pattern (absolute path):

spamc_user_name/.spamassassin/user_prefs

As '-x' is in effect, there will be no $userdir set in
handle_user_setuid_basic().
That's OK. But handle_user_set_user_prefs() ends up called with the
user name in place of the directory name.

The cause can be traced to changes in untaint_var() - instead of
returning undef for $userdir, it just... returns, shifting the
arguments.

Shouldn't the code read more like:

--- Util.pm.orig        2014-02-07 09:36:28.000000000 +0100
+++ Util.pm     2014-02-20 14:47:09.879293333 +0100
@@ -285,7 +285,7 @@
   my $r = ref $_[0];
   if (!$r) {
     no re 'taint';  # override a  "use re 'taint'"  from outer scope
-    return if !defined $_[0];
+    return undef if !defined $_[0];
     local($1); # avoid Perl taint bug: tainted global $1 propagates
taintedness
     $_[0] =~ /^(.*)\z/s;
     return $1; 

Mark Martinec; Agreed, it's a bug. Your fix is alright.
While in most other calls it does not matter, in this case it is wrong. 

Looks like a good fix, thanks Tomasz.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to