[pmg-devel] [PATCH pmg-api 2/2] fix 'Use of uninitialized value $info'

Mira Limbeck m.limbeck at proxmox.com
Fri Jun 14 10:15:16 CEST 2019


Additional info:

$info is undefined if the mail is moved directly to the quarantine 
without running any spam checks on it.

On 6/11/19 3:27 PM, Mira Limbeck wrote:
> Return early if $info is not defined. This gets rid of the 'Use of
> uninitialized value $info' warning in the following 'split' call.
>
> Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
> ---
>   PMG/API2/Quarantine.pm | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/PMG/API2/Quarantine.pm b/PMG/API2/Quarantine.pm
> index a51cf1e..b17b7a2 100644
> --- a/PMG/API2/Quarantine.pm
> +++ b/PMG/API2/Quarantine.pm
> @@ -64,6 +64,7 @@ sub decode_spaminfo {
>       $spamdesc = PMG::Utils::load_sa_descriptions([$salocaldir]) if !$spamdesc;
>   
>       my $res = [];
> +    return $res if !defined($info);
>   
>       foreach my $test (split (',', $info)) {
>   	my ($name, $score) = split (':', $test);



More information about the pmg-devel mailing list