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

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