Skip to content

Commit 9415f58

Browse files
Make Packet._ensure_bound_field_value() recursive on lists (#4705)
1 parent 471bf40 commit 9415f58

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scapy/packet.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,11 @@ def _ensure_bound_field_value(
704704
# If `value` is a simple `list`, create a new `list_field` instance.
705705
# If `value` is already a `list_field` instance, we never know where this instance comes from, and what it's being used for.
706706
# Let's create a new `list_field` instance in any case.
707-
return list_field(self, value)
707+
return list_field(
708+
self,
709+
# Recurse on list items.
710+
[self._ensure_bound_field_value(x) for x in value],
711+
)
708712

709713
if isinstance(value, FlagValue):
710714
# We never know where the `FlagValue` instance comes from, and what it's being used for.

0 commit comments

Comments
 (0)