]> sigrok.org Git - libsigrok.git/commit
input/protocoldata: Check if lookup_protocol_name is valid
authorYann Sionneau <redacted>
Sun, 16 Mar 2025 14:11:42 +0000 (15:11 +0100)
committerSoeren Apel <redacted>
Sun, 9 Nov 2025 22:03:01 +0000 (23:03 +0100)
commitafc8ba47b1900045fd2d15d30712be4c167c95c8
tree36742fde3c20d62f8a7ff07735fbff625a089625
parentb5d2e3e98c02e0d068f9ce0f783d87856ed708ae
input/protocoldata: Check if lookup_protocol_name is valid

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.
src/input/protocoldata.c