From ddf82949bf2e65e354003b05f67829cea824bc53 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 10 Jan 2018 19:13:29 +0000 Subject: [PATCH] W_IsLumpWad: check if the file is a PK3, so it can bail out if it isn't --- src/w_wad.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 816bbd44f..ea0feef6c 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1057,11 +1057,16 @@ size_t W_LumpLength(lumpnum_t lumpnum) // boolean W_IsLumpWad(lumpnum_t lumpnum) { - const char *lumpfullName = (wadfiles[WADFILENUM(lumpnum)]->lumpinfo + LUMPNUM(lumpnum))->name2; + if (wadfiles[WADFILENUM(lumpnum)]->type == RET_PK3) + { + const char *lumpfullName = (wadfiles[WADFILENUM(lumpnum)]->lumpinfo + LUMPNUM(lumpnum))->name2; - if (strlen(lumpfullName) < 4) - return false; // can't possibly be a wad can it? - return !strnicmp(lumpfullName + strlen(lumpfullName) - 4, ".wad", 4); + if (strlen(lumpfullName) < 4) + return false; // can't possibly be a WAD can it? + return !strnicmp(lumpfullName + strlen(lumpfullName) - 4, ".wad", 4); + } + + return false; // WADs should never be inside non-PK3s as far as SRB2 is concerned } /* report a zlib or i/o error */