Subject: | parsing method doesn't return value due to newlines |
This was discovered when I tried getting the cve method, which is
formatted in the file like this:
script_cve_id(
"CVE-2011-1148",
"CVE-2011-1657",
...
);
The regexp that parses this assumes no newlines between ( and first ".
The patch I created replaces the /o with a /s and looks for everything
between the parentheses, since the following code strips white-spaces,
commas and quote marks.
Subject: | plugin.diff |
--- /usr/local/share/perl5/Parse/Nessus/Plugin.pm 2011-11-24 18:40:20.595427963 +0200
+++ /usr/local/share/perl5/Parse/Nessus/Plugin.pm 2011-11-24 18:55:56.928379244 +0200
@@ -260,7 +260,7 @@ sub cve {
return undef;
}
- if($file =~ /script\_cve\_id\(([^)]+)\)/s) {
+ if($file =~ /script\_cve\_id\(\"([^\)]*)\"\)/o) {
my $cve = $1;
$cve =~ s/\"//g;$cve =~ s/\s//g;
if(my $cve || $cve eq '') {