From ccbc19f92c2ba212df4df11076cd02ea71ae53eb Mon Sep 17 00:00:00 2001 From: "Breno G. de Oliveira" Date: Thu, 5 Sep 2013 15:48:25 -0300 Subject: [PATCH] removing warnings for uninitialized values when 'alt', 'cve' or 'mil' data is not available, the variables contain the undefined value. As such, calling length() on them trigger a warning. This patch changes the validation to simply check if the variables are defined. --- Linux_Exploit_Suggester.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Linux_Exploit_Suggester.pl b/Linux_Exploit_Suggester.pl index e71fe2e..64456b4 100755 --- a/Linux_Exploit_Suggester.pl +++ b/Linux_Exploit_Suggester.pl @@ -102,10 +102,10 @@ foreach my $key(keys %h){ my $alt = $h{$key}->{alt}; my $cve = $h{$key}->{cve}; my $mlw = $h{$key}->{mil}; - if ((length ($alt) >0)||(length ($cve) >0)){print "\n";} - if (length ($alt) >0){ print " Alt: $alt ";} - if (length ($cve) >0){ print " CVE-$cve";} - if (length ($mlw) >0){ print "\n Source: $mlw";} + if ($alt or $cve){print "\n";} + if ($alt){ print " Alt: $alt ";} + if ($cve){ print " CVE-$cve";} + if ($mlw){ print "\n Source: $mlw";} print "\n"; } }