From 9fb9fa763e873eee9d281516a89112194ad52fef Mon Sep 17 00:00:00 2001 From: Nong Hoang Tu Date: Sun, 27 Oct 2024 18:31:43 +0700 Subject: [PATCH] Add a comment to explain problem with current logic that handles . and .. --- src/engine/scan_file.nim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/engine/scan_file.nim b/src/engine/scan_file.nim index a48c8fc..1cc079d 100644 --- a/src/engine/scan_file.nim +++ b/src/engine/scan_file.nim @@ -184,6 +184,8 @@ proc fscanner_walk_dir_rec*(scan_ctx: var FileScanCtx, scan_dir: string, virname current_node_name = $cast[cstring](addr(ptr_dir.d_name)) # Linux's dir always have "." as current dir and ".." as parent DIR. Skip checking these 2 nodes + # TODO better handing with "..": in folders that has only 1 node (beside . and ..), it might be hidden by malware. + # Using ".." might be able to detect them (if d_reclen's logic can be fixed for the last node) if current_node_name == "." or current_node_name == "..": continue