Browse Source

libdpkg: Do not accept empty field names

These are just bogus, and should have never been accepted.
Guillem Jover 13 years ago
parent
commit
eecc61381b
2 changed files with 3 additions and 0 deletions
  1. 1 0
      debian/changelog
  2. 2 0
      lib/dpkg/parse.c

+ 1 - 0
debian/changelog

@@ -107,6 +107,7 @@ dpkg (1.17.2) UNRELEASED; urgency=low
     a theoretical problem where a package could get appended to be removed,
     then reinstalled as a new version, to get removed again when revisiting
     the array in a subsequent package processing. Closes: #726112
+  * Do not accept empty field names in dpkg.
 
   [ Updated programs translations ]
   * German (Sven Joachim).

+ 2 - 0
lib/dpkg/parse.c

@@ -581,6 +581,8 @@ parse_stanza(struct parsedb_state *ps, struct field_state *fs,
     while (!parse_EOF(ps) && !isspace(c) && c != ':' && c != MSDOS_EOF_CHAR)
       c = parse_getc(ps);
     fs->fieldlen = ps->dataptr - fs->fieldstart - 1;
+    if (fs->fieldlen == 0)
+      parse_error(ps,  _("empty field name"));
 
     /* Skip spaces before ‘:’. */
     while (!parse_EOF(ps) && c != '\n' && isspace(c))