[Secure-testing-commits] r16040 - bin

Petter Reinholdtsen pere at alioth.debian.org
Wed Feb 2 20:50:57 UTC 2011


Author: pere
Date: 2011-02-02 20:50:57 +0000 (Wed, 02 Feb 2011)
New Revision: 16040

Modified:
   bin/compare-nvd-cve
Log:
Implement support for comments in CPE files.   Sort CVE list in reverse order.

Modified: bin/compare-nvd-cve
===================================================================
--- bin/compare-nvd-cve	2011-02-02 20:43:21 UTC (rev 16039)
+++ bin/compare-nvd-cve	2011-02-02 20:50:57 UTC (rev 16040)
@@ -18,6 +18,7 @@
 my $lastcpe = "";
 while (<$fh>) {
     chomp;
+    s/#.*$//; # Remove comments
     unless ($_) {
        $lastcpe = "";
        next;
@@ -43,6 +44,7 @@
 open($fh, "<", "data/CPE/list") || die;
 while (<$fh>) {
     chomp;
+    s/#.*$//; # Remove comments
     my ($binpkg, $cpe) = split(/;/);
     $cpe = cpe_expand_alias($cpe);
 #    $cpe = "unknown-$binpkg" unless $cpe;
@@ -59,7 +61,9 @@
     chomp;
     $cve = $1 if (m/^(CVE-\S+)\s*/);
     s/^(\s+)\[\S+\] /$1/; # Trim away distribution name
-    if (m/^\s+- (\S+)\S*/ && ! m/<not-affected>/) {
+    if ( m/^\s+- (\S+)\S*/
+         && ! m/<not-affected>/
+       ) {
         my $srcpkg = $1;
         if (exists $cvemap{$cve}) {
             push(@{$cvemap{$cve}}, $srcpkg);
@@ -79,10 +83,14 @@
 #     "nvdcve-2.0-2010.xml",
 #     "nvdcve-2.0-2009.xml",
 #     "nvdcve-2.0-2008.xml",
+#     "nvdcve-2.0-2007.xml",
+#     "nvdcve-2.0-2006.xml",
+#     "nvdcve-2.0-2005.xml",
+#     "nvdcve-2.0-2004.xml",
     ) {
     print "Loading $cvelist\n" if $debug;
     my $ref = XMLin("../../" . $cvelist);
-    for my $cve (sort keys %{$ref->{entry}}) {
+    for my $cve (sort {$b cmp $a} keys %{$ref->{entry}}) {
         print "Checking $cve\n" if $debug;
         my $entry = $ref->{entry}->{$cve};
 




More information about the Secure-testing-commits mailing list