Skip to content
This repository was archived by the owner on May 16, 2025. It is now read-only.

Commit 74f1134

Browse files
committed
Linux - more smear protection
1 parent 781d74a commit 74f1134

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

volatility/plugins/linux/mount.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,21 @@ def _parse_mnt(self, mnt, ns, fs_types):
6262
if not dev_name.is_valid() or len(dev_name) < 3:
6363
return ret
6464

65+
for nn in str(dev_name)[:3]:
66+
n = ord(nn)
67+
if n < 32 or n > 126 or n == 63: # 63 = ?
68+
return ret
69+
6570
fstype = mnt.mnt_sb.s_type.name.dereference_as("String", length = linux_common.MAX_STRING_LENGTH)
6671

67-
if not fstype.is_valid():
72+
if not fstype.is_valid() or len(fstype) < 3:
6873
return ret
6974

75+
for nn in str(fstype)[:3]:
76+
n = ord(nn)
77+
if n < 32 or n > 126 or n == 63: # 63 = ?
78+
return ret
79+
7080
path = linux_common.do_get_path(mnt.mnt_sb.s_root, mnt.mnt_parent, mnt.mnt_root, mnt)
7181
if path == []:
7282
return ret
@@ -168,7 +178,7 @@ def calculate(self):
168178
for t in tmp_mnts:
169179
tt = t.mnt_devname.dereference_as("String", length = linux_common.MAX_STRING_LENGTH)
170180
if tt:
171-
if len(str(tt)) > 2 or str(tt)[0] == '/':
181+
if len(str(tt)) > 2 or (len(str(tt)) > 1 and str(tt)[0] == '/'):
172182
all_mnts.append(t)
173183

174184
list_mnts = {}

0 commit comments

Comments
 (0)