Blame SOURCES/0004-Avoid-returning-CHM-file-entries-that-are-blank-beca.patch

ddbc83
From 31f7eb6d370d1ca5ec70a6143bf3d6bc2863f254 Mon Sep 17 00:00:00 2001
08863e
From: Stuart Caie <kyzer@cabextract.org.uk>
08863e
Date: Wed, 17 Oct 2018 11:29:03 +0100
ddbc83
Subject: [PATCH 4/6] Avoid returning CHM file entries that are "blank" because
08863e
 they have embedded null bytes
08863e
08863e
(cherry picked from commit 8759da8db6ec9e866cb8eb143313f397f925bb4f)
08863e
---
08863e
 libmspack/trunk/mspack/chmd.c | 6 +++---
08863e
 1 file changed, 3 insertions(+), 3 deletions(-)
08863e
08863e
diff --git a/libmspack/trunk/mspack/chmd.c b/libmspack/trunk/mspack/chmd.c
08863e
index cea9fc2..beaccb7 100644
08863e
--- a/libmspack/trunk/mspack/chmd.c
08863e
+++ b/libmspack/trunk/mspack/chmd.c
08863e
@@ -447,14 +447,14 @@ static int chmd_read_headers(struct mspack_system *sys, struct mspack_file *fh,
08863e
     while (num_entries--) {
08863e
       READ_ENCINT(name_len);
08863e
       if (name_len > (unsigned int) (end - p)) goto chunk_end;
08863e
-      /* consider blank filenames to be an error */
08863e
-      if (name_len == 0) goto chunk_end;
08863e
       name = p; p += name_len;
08863e
-
08863e
       READ_ENCINT(section);
08863e
       READ_ENCINT(offset);
08863e
       READ_ENCINT(length);
08863e
 
08863e
+      /* ignore blank or one-char (e.g. "/") filenames we'd return as blank */
08863e
+      if (name_len < 2 || !name[0] || !name[1]) continue;
08863e
+
08863e
       /* empty files and directory names are stored as a file entry at
08863e
        * offset 0 with length 0. We want to keep empty files, but not
08863e
        * directory names, which end with a "/" */
08863e
-- 
ddbc83
2.22.0
08863e