Skip to content

Commit 25cc3e4

Browse files
committed
Do length checks in V/BSP
1 parent 1434475 commit 25cc3e4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

SabreTools.Serialization/Deserializers/BSP.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class BSP : BaseBinaryDeserializer<BspFile>
2828

2929
// Try to parse the header
3030
var header = data.ReadType<BspHeader>();
31-
if (header?.Lumps == null)
31+
if (header?.Lumps == null || header.Lumps.Length != BSP_HEADER_LUMPS)
3232
return null;
3333
if (header.Version < 29 || header.Version > 30)
3434
return null;

SabreTools.Serialization/Deserializers/VBSP.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class VBSP : BaseBinaryDeserializer<VbspFile>
3232
return null;
3333
if (Array.IndexOf([17, 18, 19, 20, 21, 22, 23, 25, 27, 29, 0x00040014], header.Version) > -1)
3434
return null;
35-
if (header.Lumps == null)
35+
if (header.Lumps == null || header.Lumps.Length != VBSP_HEADER_LUMPS)
3636
return null;
3737

3838
// Set the package header

0 commit comments

Comments
 (0)