Skip to content

[check_manfile.py] Fix file handle leak#967

Merged
zakird merged 3 commits into
zmap:mainfrom
mitre88:fix/file-handle-leak-check-manfile
May 1, 2026
Merged

[check_manfile.py] Fix file handle leak#967
zakird merged 3 commits into
zmap:mainfrom
mitre88:fix/file-handle-leak-check-manfile

Conversation

@mitre88
Copy link
Copy Markdown
Contributor

@mitre88 mitre88 commented May 1, 2026

Summary

  • File handle leak fixed in scripts/check_manfile.py line 29
  • The open() call for the ronn file was not using a context manager

Fix

  • Wrapped the open() call in a with statement to ensure proper resource cleanup

Open Source Contributor and others added 3 commits April 20, 2026 19:01
When rdlength is 0, the code would:
1. xmalloc(0) allocates a zero-size buffer
2. memcpy(txt, rdata + 1, rdlength - 1) underflows uint16_t to 65535
3. Writing ~64KB to a 0-byte buffer causes heap corruption

Add explicit rdlength==0 check before the TXT parsing logic.

Fixes zmap#962
@zakird zakird merged commit eb52c3b into zmap:main May 1, 2026
12 checks passed
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.

2 participants