From d92902a3490584ef0c458880ee3b4040d1842289 Mon Sep 17 00:00:00 2001 From: Peter Pentchev Date: Sun, 22 Aug 2021 14:46:21 +0300 Subject: [PATCH] Add a read error detection fix to the cppcheck patch. --- debian/patches/cppcheck.patch | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/debian/patches/cppcheck.patch b/debian/patches/cppcheck.patch index f093eb7..8778dab 100644 --- a/debian/patches/cppcheck.patch +++ b/debian/patches/cppcheck.patch @@ -26,3 +26,20 @@ Last-Update: 2021-08-22 comp->cctx = ZSTD_createCCtx(); #ifndef OLD_ZSTD +--- a/src/lib/io.c ++++ b/src/lib/io.c +@@ -115,11 +115,13 @@ + char *data = zmalloc(BUF_SIZE); + + while((read_count = read(zck->temp_fd, data, BUF_SIZE)) > 0) { +- if(read_count == -1 || !write_data(zck, zck->fd, data, read_count)) { ++ if(!write_data(zck, zck->fd, data, read_count)) { + free(data); + return false; + } + } + free(data); ++ if(read_count == -1) ++ return false; + return true; + } -- 2.30.2