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

Fix recursive tcpedit cleanup #855

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GabrielGanne
Copy link
Contributor

Assume a single tcpedit struct and return the previously allocated context if called twice.

This fixes an issue with the Juniper Encapsulated Ethernet DLT plugin which has an exception in the way the plugins works with regard to the extra buffer in question: tcpreplay works with the assumption that there only ever is a single link layer plugin which is mostly true except here: Juniper has a special call to tcpedit_dlt_copy_decoder_state() which causes the ctx and subctx to share a reference to the decoded_extra buffer, and a double free.

Fixes: #813 #850

Assume a single tcpedit struct and return the previously allocated
context.

This fixes an issue with the Juniper Encapsulated Ethernet DLT plugin
which has an exception in the way the plugins works with regard to the
extra buffer in question: tcpreplay works with the assumption that there
only ever is a single link layer plugin which is mostly true except
here: Juniper has a special call to tcpedit_dlt_copy_decoder_state()
which causes the ctx and subctx to share a reference to the
decoded_extra buffer, and a double free.

Fixes: appneta#813 appneta#850
@GabrielGanne
Copy link
Contributor Author

Hi,
cpp-linter is failing with the following error:

src/tcpedit/plugins/dlt_plugins.c:21:10 [clang-diagnostic-error]: src/tcpedit/plugins/dlt_plugins.c#L21
'config.h' file not found

Is it possible this is some configuration issue ? The normal build works fine.
BR

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.

[Bug] Double free in tcpedit_dlt_cleanup in tcprewrite
1 participant