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

input: protocoldata: make sure lookup_protocol_name stays safe from NULL pointer dereferencing #261

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

Conversation

fallen
Copy link

@fallen fallen commented Mar 16, 2025

As of today, the code does not crash because all protocols have names. But the name of the first element is not checked to be non-NULL before calling strcmp(). This can result in a future crash if the code logic changes.

This is mostly a change to robustify the lookup_protocol_name() function.

Also, this commit simplifies the indexing logic of the protocols array.

…ULL pointer dereferencing

As of today, the code does not crash because all protocols have names.
But the name of the first element is not checked to be non-NULL
before calling strcmp(). This can result in a future crash if the
code logic changes.

This is mostly a change to robustify the lookup_protocol_name() function.

Also, this commit simplifies the indexing logic of the protocols array.
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.

1 participant