]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - fs.c
fs: Use unsigned short for filename size
[xonotic/darkplaces.git] / fs.c
diff --git a/fs.c b/fs.c
index cae6d309d66e971d78365d7fb8029d3697a6fff1..25789e0235888c1f58d199fd65c30184e6711e70 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -683,7 +683,7 @@ static int PK3_BuildFileList (pack_t *pack, const pk3_endOfCentralDir_t *eocd)
                        return -1;
                }
 
-               namesize = BuffLittleShort (&ptr[28]);  // filename length
+               namesize = (unsigned short)BuffLittleShort (&ptr[28]);  // filename length
 
                // Check encryption, compression, and attributes
                // 1st uint8  : general purpose bit flag
@@ -700,7 +700,7 @@ static int PK3_BuildFileList (pack_t *pack, const pk3_endOfCentralDir_t *eocd)
                if ((ptr[8] & 0x21) == 0 && (ptr[38] & 0x18) == 0)
                {
                        // Still enough bytes for the name?
-                       if (namesize < 0 || remaining < namesize || namesize >= (int)sizeof (*pack->files))
+                       if (remaining < namesize || namesize >= (int)sizeof (*pack->files))
                        {
                                Mem_Free (central_dir);
                                return -1;