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

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