This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=45f004ea979e12dea12043558629efe5aa377bf2

commit 45f004ea979e12dea12043558629efe5aa377bf2
Author: Guillem Jover <[email protected]>
AuthorDate: Thu Aug 29 01:33:41 2019 +0200

    libdpkg: Use the totalwritten variable for a consistency check
    
    The variable was written to but never used.
    
    Warned-by: cppcheck
---
 debian/changelog  | 1 +
 lib/dpkg/buffer.c | 2 ++
 2 files changed, 3 insertions(+)

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"));
 

-- 
Dpkg.Org's dpkg

Reply via email to