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

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