Просмотр исходного кода

dpkg-parsechangelog: Do not accept values bundled with long option names

The parser was accepting things like «--count10», which is just broken.
Instead allow only «--count=10» in addition to «--count 10».
Guillem Jover лет назад: 11
Родитель
Сommit
5e4830d28f
2 измененных файлов с 5 добавлено и 6 удалено
  1. 3 0
      debian/changelog
  2. 2 6
      scripts/dpkg-parsechangelog.pl

+ 3 - 0
debian/changelog

@@ -5,6 +5,9 @@ dpkg (1.17.21) UNRELEASED; urgency=low
     patch Depends, and a Breaks patch (<< 2.7) to libdpkg-perl.
   * Error out on obsolete Build-Profiles field syntax.
   * Document -g and -G options in dpkg-genchanges(1). Closes: #766568
+  * Do not accept values bundled with long options in dpkg-parsechangelog.
+    The parser was accepting things like «--count10», which is just broken.
+    Instead allow only «--count=10» in addition to «--count 10».
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).

+ 2 - 6
scripts/dpkg-parsechangelog.pl

@@ -105,12 +105,8 @@ while (@ARGV) {
 	    $options{until} = $2;
 	    ## use critic
 	}
-    } elsif (m/^--(count|file|format|from|offset|since|to|until)(.*)$/) {
-	if ($2) {
-	    $options{$1} = $2;
-	} else {
-	    $options{$1} = shift(@ARGV);
-	}
+    } elsif (m/^--(count|file|format|from|offset|since|to|until)(?:=(.+))?$/) {
+        $options{$1} = $2 // shift;
     } elsif (m/^--all$/) {
 	$options{all} = undef;
     } elsif (m/^-(?:\?|-help)$/) {