[pmg-devel] applied: [PATCH v2 pmg-api] fix use of uninitialized value

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Jun 18 12:24:54 CEST 2019


On 6/18/19 11:26 AM, Mira Limbeck wrote:
> Return early if $info is not defined.
> 
> When moving a mail directly to quarantine without running any checks
> there's no spaminfo available. As a result the value $info is undefined.
> 
> Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
> ---
> v2:
>  - exit before the expensive load_sa_descriptions call
> 
>  PMG/API2/Quarantine.pm | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/PMG/API2/Quarantine.pm b/PMG/API2/Quarantine.pm
> index a51cf1e..db1822f 100644
> --- a/PMG/API2/Quarantine.pm
> +++ b/PMG/API2/Quarantine.pm
> @@ -57,14 +57,15 @@ my $verify_optional_pmail = sub {
>  sub decode_spaminfo {
>      my ($info) = @_;
>  
> +    my $res = [];
> +    return $res if !defined($info);
> +
>      my $saversion = Mail::SpamAssassin->VERSION;
>  
>      my $salocaldir = "/var/lib/spamassassin/$saversion/updates_spamassassin_org";
>  
>      $spamdesc = PMG::Utils::load_sa_descriptions([$salocaldir]) if !$spamdesc;
>  
> -    my $res = [];
> -
>      foreach my $test (split (',', $info)) {
>  	my ($name, $score) = split (':', $test);
>  
> 

applied, thanks!



More information about the pmg-devel mailing list