Re: [PATCH] git-send-email.perl: avoid printing undef when validating addresses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 18, 2023 at 12:35:53PM -0400, Taylor Blau wrote:

> When validating email addresses with `extract_valid_address_or_die()`,
> we print out a helpful error message when the given input does not
> contain a valid email address.
> 
> However, the pre-image of this patch looks something like:
> 
>     my $address = shift;
>     $address = extract_valid_address($address):
>     die sprintf(__("..."), $address) if !$address;
> 
> which fails when given a bogus email address by trying to use $address
> (which is undef) in a sprintf() expansion, like so:
> 
>     $ git.compile send-email --to="pi <pi@pi>" /tmp/x/*.patch --force
>     Use of uninitialized value $address in sprintf at /home/ttaylorr/src/git/git-send-email line 1175.
>     error: unable to extract a valid address from:

Yeah, we overwrite the variable we're reporting on, so I don't think the
original could possibly work. Your fix makes sense.

> This regression dates back to e431225569 (git-send-email: remove invalid
> addresses earlier, 2012-11-22), but became more noticeable in a8022c5f7b
> (send-email: expose header information to git-send-email's
> sendemail-validate hook, 2023-04-19), which validates SMTP headers in
> the sendemail-validate hook.

I didn't quite understand how a8022c5f7b made this worse, but I guess we
just call it the bad function in more instances. The bug is definitely
from e431225569, though.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux