gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libextractor] 05/27: defensive programming: avoid malloc(0


From: gnunet
Subject: [GNUnet-SVN] [libextractor] 05/27: defensive programming: avoid malloc(0) in deb extractor
Date: Sun, 15 Oct 2017 21:34:29 +0200

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

grothoff pushed a commit to branch master
in repository libextractor.

commit f71355829ab07f9632e3c1195f8bffa50e40826e
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Oct 15 19:49:27 2017 +0200

    defensive programming: avoid malloc(0) in deb extractor
---
 ChangeLog                   | 3 ++-
 src/plugins/deb_extractor.c | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index f6dd28e1..c2a27af6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,8 @@
 Sun Oct 15 19:36:41 CEST 2017
        Fix potential file descriptor leak (on error handling path).
        Fix potential assign-after-free (on IPC error handling path).
-       Make sure to only pass "unsigned char" to functions like isspace(). -CG
+       Make sure to only pass "unsigned char" to functions like isspace().
+       Avoid malloc(0) in DEB extractor under certain conditions. -CG
 
 Fri Oct 13 12:30:37 CEST 2017
        Properly check read error in NSF plugin (from signedness confusion) 
found by Leon Zhao. -CG
diff --git a/src/plugins/deb_extractor.c b/src/plugins/deb_extractor.c
index 47167322..afbe8bb5 100644
--- a/src/plugins/deb_extractor.c
+++ b/src/plugins/deb_extractor.c
@@ -363,6 +363,8 @@ processControlTGZ (struct EXTRACTOR_ExtractContext *ec,
 
   if (size > MAX_CONTROL_SIZE)
     return 0;
+  if (0 == size)
+    return 0;
   if (NULL == (cdata = malloc (size)))
     return 0;
   off = 0;

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]