#506390 libmailtools-perl: Mail::Internet Doesn't check for empty fullname in GECOS

#506390#5
Date:
2008-11-21 06:25:43 UTC
From:
To:
When run by a user without a fullname in the GECOS, such as:

user:x:1000:1000:,,,:/home/user:/bin/bash

Mail::Internet throws these errors:

Use of uninitialized value $name in pattern match (m//) at /usr/share/perl5/Mail/Internet.pm line 536.
Use of uninitialized value $name in sprintf at /usr/share/perl5/Mail/Internet.pm line 541.

The problem is these lines:

my $name = eval {local $SIG{__DIE__}; (getpwuid($>))[6]} || $ENV{NAME} ||"";

    while($name =~ s/\([^\(\)]*\)//) { 1; }

    # Strip extra fields: adduser-generated usernames have multiple comma
    # seperated fields, only the first of which should be used to prevent
    # accidental exposure of system-local information like phone numbers/
    # room numbers.
    $name = (split /,/, $name)[0];

    if($name =~ /[^\w\s]/)
    {   $name =~ s/"/\"/g;
        $name = '"' . $name . '"';
    }

    my $from = sprintf "%s <%s>", $name, mailaddress();

$name is set equal to the first field of the GECOS, which is assumed to be
non-null; when it is not defined, the errors are thrown.  I suppose there
should be tests for non-null values, and the code should only be executed for
defined fullnames.

#506390#8
Date:
2008-11-21 07:17:05 UTC
From:
To:
Hello Mark,

I'm forwarding this bug report to you as upstream author.

Please preserve the CC to 506390-forwarded@bugs.debian.org when you
reply, so that the bug tracking system will file your reply with the
original report.

The corresponding web page of this bug report is at:

http://bugs.debian.org/506390

This bug report is a duplicate of #495242, which I've forwarded to you
already.

The debian bmailtools-perl bug reports are at:

http://bugs.debian.org/libmailtools-perl

Thank you,

Aníbal Monsalve Salazar

#506390#11
Date:
2008-11-22 23:09:14 UTC
From:
To:
On Fri, 21 Nov 2008 18:17:05 +1100 Aníbal Monsalve Salazar <anibal@debian.org> wrote:

...
you

Oh, sorry.  I did dutifully check the list of already reported bugs,
but I didn't recognize from the title of #495242 that mine was a
duplicate.

Celejar
--
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator