pr: flooding possible if error is caused during binwalk (Denial of service)

This commit is contained in:
mint
2025-11-28 16:01:14 +08:00
parent b00e1b45c7
commit 049cec75a9
+4 -4
View File
@@ -40,6 +40,10 @@ def analyze_binwalk(input_img: Path, output_dir: Path) -> None:
zip_exist = True zip_exist = True
stderr += zip_data.stderr stderr += zip_data.stderr
# Remove the extracted directory
if extracted_dir.exists():
shutil.rmtree(extracted_dir)
if len(stderr) > 0: if len(stderr) > 0:
err = { err = {
"binwalk": { "binwalk": {
@@ -50,10 +54,6 @@ def analyze_binwalk(input_img: Path, output_dir: Path) -> None:
update_data(output_dir, err) update_data(output_dir, err)
return None return None
# Remove the extracted directory
if extracted_dir.exists():
shutil.rmtree(extracted_dir)
output_data = { output_data = {
"binwalk": { "binwalk": {
"status": "ok", "status": "ok",