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

libdpkg: Print a longer string when an unknown field value is found

Use a capped string length instead of using last namevalue length
member when printing the disallowed value when parsing.
Guillem Jover лет назад: 18
Родитель
Сommit
9274078c46
3 измененных файлов с 9 добавлено и 1 удалено
  1. 6 0
      ChangeLog
  2. 1 0
      debian/changelog
  3. 2 1
      lib/fields.c

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2008-07-02  Guillem Jover  <guillem@debian.org>
+
+	* lib/fields.c (convert_string): Use a capped string length instead
+	of using last namevalue length member when printing the disallowed
+	value.
+
 2008-07-02  Guillem Jover  <guillem@debian.org>
 
 	* src/query.c (limiteddescription): Use NULL instead of 0.

+ 1 - 0
debian/changelog

@@ -25,6 +25,7 @@ dpkg (1.15.0) UNRELEASED; urgency=low
   * Do not allocate memory when lstat fails during package upgrade.
   * Properly lstat the correct file when using --root on package upgrade.
     Thanks to Egmont Koblinger. Closes: #281057
+  * Print a longer string when a disallowed field value is found when parsing.
 
   [ Raphael Hertzog ]
   * Enhance dpkg-shlibdeps's error message when a library can't be found to

+ 2 - 1
lib/fields.c

@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <string.h>
+#include "strnlen.h"
 
 #include <dpkg.h>
 #include <dpkg-db.h>
@@ -57,7 +58,7 @@ convert_string(const char *filename, int lno, const char *what, int otherwise,
   if (!nvip->name) {
     if (otherwise != -1) return otherwise;
     parse_error(filename, lno, pigp, _("`%.*s' is not allowed for %s"),
-                l > 50 ? 50 : l, startp, what);
+                strnlen(startp, 50), startp, what);
   }
   ep = startp + l;
   c = *ep;