From 6a4d5bddeba72599041964ab9323b9bf3811b99d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 28 Jul 2025 15:13:38 -0400 Subject: [PATCH] Ensure memory streams are scoped in MS-CAB --- BinaryObjectScanner/FileType/MicrosoftCAB.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/BinaryObjectScanner/FileType/MicrosoftCAB.cs b/BinaryObjectScanner/FileType/MicrosoftCAB.cs index facfe37f..7b6d5912 100644 --- a/BinaryObjectScanner/FileType/MicrosoftCAB.cs +++ b/BinaryObjectScanner/FileType/MicrosoftCAB.cs @@ -41,9 +41,11 @@ namespace BinaryObjectScanner.FileType // Loop through the folders for (int f = 0; f < cabArchive!.Model.Folders.Length; f++) { - // Decompress the blocks, if possible + // Get the current folder for processing var folder = cabArchive.Model.Folders[f]; - var ms = DecompressBlocks(cabArchive, file, folder, f); + + // Decompress the blocks, if possible + using var ms = DecompressBlocks(cabArchive, file, folder, f); if (ms == null || ms.Length == 0) continue;