Depending on how the stack grows read_line() could go beyond the end of the buffer when looking for a newline.
@@ -1,5 +1,8 @@
dpkg (1.16.3) UNRELEASED; urgency=low
+ [ Guillem Jover ]
+ * Do not look for newline beyond the read buffer on dpkg-deb extract.
+
[ Updated dpkg translations ]
* French (Christian Perrier)
* German (Sven Joachim).
@@ -86,7 +86,7 @@ read_line(int fd, char *buf, size_t min_size, size_t max_size)
if (r <= 0)
return r;
- nl = strchr(buf + line_size, '\n');
+ nl = memchr(buf + line_size, '\n', r);
line_size += r;
if (nl != NULL) {