Skip to content

Conversation

@T3pp31
Copy link
Contributor

@T3pp31 T3pp31 commented Sep 16, 2025

Checklist:

  • If you are new to Scapy: I have checked CONTRIBUTING.md (esp. section submitting-pull-requests)
  • I squashed commits belonging together
  • I added unit tests or explained why they are not relevant
  • I executed the regression tests (using tox)
  • If the PR is still not finished, please create a Draft Pull Request

fixes #4836

@codecov
Copy link

codecov bot commented Sep 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.88%. Comparing base (b673424) to head (2f719ca).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4837   +/-   ##
=======================================
  Coverage   80.87%   80.88%           
=======================================
  Files         368      368           
  Lines       90242    90244    +2     
=======================================
+ Hits        72987    72993    +6     
+ Misses      17255    17251    -4     
Files with missing lines Coverage Δ
scapy/layers/dhcp.py 82.91% <100.00%> (+0.10%) ⬆️

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@T3pp31
Copy link
Contributor Author

T3pp31 commented Sep 16, 2025

Implementing an iterator in RandDHCPOptions in scapy/layers/dhcp.py will prevent fuzz(DHCP()).show() from crashing with TypeError: ‘RandDHCPOptions’ object is not iterable. Specifically, add the following method to the class definition:

def __iter__(self):
    return iter(self._fix())

(If necessary, delegate getitem to return the result of _fix() as well. This ensures stable behavior even when index access is used repeatedly.)

DHCPOptionsField.i2repr() and i2m() process values sequentially, so if RandDHCPOptions has an iterator, it can be handled directly.

Copy link
Member

@gpotter2 gpotter2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR ! LGTM.

@gpotter2 gpotter2 merged commit aa1fe52 into secdev:master Sep 16, 2025
24 checks passed
@T3pp31 T3pp31 deleted the #4836 branch September 16, 2025 15:49
@gpotter2 gpotter2 added this to the 2.7.0 milestone Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DHCP() cannot be 'fuzz' due to bad object placement

2 participants