diff options
author | Guillem Jover <guillem@debian.org> | 2019-08-29 01:33:41 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2019-10-30 22:02:44 +0100 |
commit | 45f004ea979e12dea12043558629efe5aa377bf2 (patch) | |
tree | a4aea81ef2f9b074909361f1d170c67d3f0b2555 | |
parent | 94886592cafa0bfbed76b8ab58814f657074d236 (diff) | |
download | dpkg-45f004ea979e12dea12043558629efe5aa377bf2.tar.gz |
libdpkg: Use the totalwritten variable for a consistency check
The variable was written to but never used.
Warned-by: cppcheck
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | lib/dpkg/buffer.c | 2 |
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")); |