Skip to content
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

Calling ip_napt_enable with 0.0.0.0 or an address that doesn't match an existing interface results in a NULL free (IDFGH-12823) #69

Open
mstrow opened this issue May 15, 2024 · 0 comments
Assignees

Comments

@mstrow
Copy link

mstrow commented May 15, 2024

Issue

If the ip_napt_table pointer hasn't been initialized previously, calling ip_napt_enable with 0.0.0.0 or an address that doesn't match an existing interface results in ip_napt_deinit being called which subsequently tries to free the ip_napt_table pointer (which defaults to NULL).

Because ip_napt_enable has no return, when the caller passes the enable flag, they don't know if the operation succeeded and would then require the function to be called again with the disable flag to clean it up.

Proposed solutions

  • As is done in ip_napt_init, the ip_napt_table pointer should be checked that it is not NULL before attempting to free it.
  • Make ip_napt_enable return a return code/boolean so the caller knows if the address argument matched one of the interfaces. This would also have the added benefit of the caller knowing they don't have to disable napt for the interface if it failed to enable it in the first place.
@github-actions github-actions bot changed the title Calling ip_napt_enable with 0.0.0.0 or an address that doesn't match an existing interface results in a NULL free Calling ip_napt_enable with 0.0.0.0 or an address that doesn't match an existing interface results in a NULL free (IDFGH-12823) May 15, 2024
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

No branches or pull requests

4 participants