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=cf8fe0d6e74fdc6970ceb17e44ec9f67901120b8

commit cf8fe0d6e74fdc6970ceb17e44ec9f67901120b8
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Sun Aug 16 23:02:56 2020 +0200

    libdpkg: Fix memory leaks in tar_extractor()
    
    We need to free the members when assigning into them for the GNU
    longlink and longname extensions.
    
    Warned-by: gcc ASAN
    Stable-Candidate: 1.19.x
---
 lib/dpkg/tarfn.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c
index a0821f217..41641b934 100644
--- a/lib/dpkg/tarfn.c
+++ b/lib/dpkg/tarfn.c
@@ -474,11 +474,15 @@ tar_extractor(struct tar_archive *tar)
                }
                if (h.type != TAR_FILETYPE_GNU_LONGLINK &&
                    h.type != TAR_FILETYPE_GNU_LONGNAME) {
-                       if (next_long_name)
+                       if (next_long_name) {
+                               free(h.name);
                                h.name = next_long_name;
+                       }
 
-                       if (next_long_link)
+                       if (next_long_link) {
+                               free(h.linkname);
                                h.linkname = next_long_link;
+                       }
 
                        next_long_link = NULL;
                        next_long_name = NULL;

-- 
Dpkg.Org's dpkg

Reply via email to