File libmspack-reject-blank-filenames.patch of Package libmspack.9242

From 8759da8db6ec9e866cb8eb143313f397f925bb4f Mon Sep 17 00:00:00 2001
From: Stuart Caie <kyzer@cabextract.org.uk>
Date: Wed, 17 Oct 2018 11:29:03 +0100
Subject: [PATCH] Avoid returning CHM file entries that are "blank" because
 they have embedded null bytes

---
 libmspack/ChangeLog     | 6 ++++++
 libmspack/mspack/chmd.c | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

Index: libmspack-0.6alpha/mspack/chmd.c
===================================================================
--- libmspack-0.6alpha.orig/mspack/chmd.c
+++ libmspack-0.6alpha/mspack/chmd.c
@@ -452,6 +452,9 @@ static int chmd_read_headers(struct mspa
       READ_ENCINT(offset);
       READ_ENCINT(length);
 
+      /* ignore blank or one-char (e.g. "/") filenames we'd return as blank */
+      if (name_len < 2 || !name[0] || !name[1]) continue;
+      
       /* empty files and directory names are stored as a file entry at
        * offset 0 with length 0. We want to keep empty files, but not
        * directory names, which end with a "/" */
openSUSE Build Service is sponsored by