[msitools: 1/6] libmsi: skip if the input stream doesn't have name




commit fe69fee4c41ca6fb4ac619ddf4b46382f5500426
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Tue Mar 16 12:19:00 2021 +0400

    libmsi: skip if the input stream doesn't have name
    
    Fixes: #33 ("Null dereference in cache_infile_structure")
    
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 libmsi/libmsi-database.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/libmsi/libmsi-database.c b/libmsi/libmsi-database.c
index c3f614a..e02d65c 100644
--- a/libmsi/libmsi-database.c
+++ b/libmsi/libmsi-database.c
@@ -2123,6 +2123,10 @@ static void cache_infile_structure( LibmsiDatabase *db )
         const char* name = gsf_input_name(in);
         const uint8_t *name8 = (const uint8_t *)name;
 
+        if (!name) {
+            g_warn_if_reached();
+            continue;
+        }
         /* table streams are not in the _Streams table */
         if (!GSF_IS_INFILE(in) || gsf_infile_num_children(GSF_INFILE(in)) == -1) {
             /* UTF-8 encoding of 0x4840.  */


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