summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog1
-rw-r--r--lib/dpkg/buffer.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 4af8bc1c7..01621e89c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -41,6 +41,7 @@ dpkg (1.20.0) UNRELEASED; urgency=medium
- Dpkg::OpenPGP: Add support for importing an OpenPGP key into a keyring.
- Dpkg::BuildFlags: Remove unused hash keys.
- libdpkg: Use the variable instead of a type as sizeof() argument.
+ - libdpkg: Use the totalwritten variable for a consistency check.
* Build system:
- Bump minimal Perl version to 5.24.1.
- Add a serial versioning to the m4 files.
diff --git a/lib/dpkg/buffer.c b/lib/dpkg/buffer.c
index 0af4da2b4..a4d6527d7 100644
--- a/lib/dpkg/buffer.c
+++ b/lib/dpkg/buffer.c
@@ -225,6 +225,8 @@ buffer_copy(struct buffer_data *read_data,
if (bytesread < 0 || byteswritten < 0)
return -1;
+ if (totalread != totalwritten)
+ return -1;
if (limit > 0)
return dpkg_put_error(err, _("unexpected end of file or stream"));