Skip to content

Fix null pointer dereference in check_sync_fuzzers #2506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 26, 2025

Conversation

lhywk
Copy link

@lhywk lhywk commented Jul 26, 2025

Describe

This patch fixes a potential null pointer dereference in the check_sync_fuzzers() function by moving the closedir(dir) call inside the if (dir) block.

Expected Behavior

closedir(dir) should only be called when dir is a valid directory pointer returned by opendir().
This ensures the program avoids undefined behavior when opendir() fails.

Actual Behavior

Previously, closedir(dir) was called unconditionally, even when dir might be NULL due to opendir() failure.
Calling closedir(NULL) results in undefined behavior and may cause a segmentation fault.

This change prevents undefined behavior and improves stability in edge cases.

Thanks for reviewing.

@vanhauser-thc vanhauser-thc changed the base branch from stable to dev July 26, 2025 09:18
@vanhauser-thc
Copy link
Member

Thank you

@vanhauser-thc vanhauser-thc merged commit 6e572ae into AFLplusplus:dev Jul 26, 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.

2 participants