瀏覽代碼

libdpkg: Do not accept empty field names

These are just bogus, and should have never been accepted.
Guillem Jover 13 年之前
父節點
當前提交
eecc61381b
共有 2 個文件被更改,包括 3 次插入0 次删除
  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,
     a theoretical problem where a package could get appended to be removed,
     then reinstalled as a new version, to get removed again when revisiting
     then reinstalled as a new version, to get removed again when revisiting
     the array in a subsequent package processing. Closes: #726112
     the array in a subsequent package processing. Closes: #726112
+  * Do not accept empty field names in dpkg.
 
 
   [ Updated programs translations ]
   [ Updated programs translations ]
   * German (Sven Joachim).
   * 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)
     while (!parse_EOF(ps) && !isspace(c) && c != ':' && c != MSDOS_EOF_CHAR)
       c = parse_getc(ps);
       c = parse_getc(ps);
     fs->fieldlen = ps->dataptr - fs->fieldstart - 1;
     fs->fieldlen = ps->dataptr - fs->fieldstart - 1;
+    if (fs->fieldlen == 0)
+      parse_error(ps,  _("empty field name"));
 
 
     /* Skip spaces before ‘:’. */
     /* Skip spaces before ‘:’. */
     while (!parse_EOF(ps) && c != '\n' && isspace(c))
     while (!parse_EOF(ps) && c != '\n' && isspace(c))