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
GH-26: Fix infinite loop on invalid next configuration parameter. #27
base: main
Are you sure you want to change the base?
GH-26: Fix infinite loop on invalid next configuration parameter. #27
Conversation
…ameter. When 'Parameter Number' and 'Next Parameter Number' are equal, configuration parameter discovery can not complete. For example, this Z-Wave frame will set Node Interview into an infinite loop: 70 : COMMAND_CLASS_CONFIGURATION 0F : CONFIGURATION_PROPERTIES_REPORT_V4 00 : Parameter Number 1 (MSB) 71 : Parameter Number 2 (LSB) 09 : Format 0x01 Unsigned Integer, size 0x1 01 : Min Value 64 : Max Value 0A : Default Value 00 : Next Parameter Number (MSB) 71 : Next Parameter Number (LSB) 02 : No Bulk support 0x1, Not Advanced Parameter 0x0 Signed-off-by: Nenad Kljajic <nkljajic@control4.com>
ok this change looks good, I'll give a try, meanwhile a unit test covering this would be welcome |
Great ! I see this building on your side: We can give a try on our codebase cc: @silabs-borisl |
ZPC implementation only Forwarded: SiliconLabs#27 Bug-SiliconLabs: UIC-3066 Bug-Github: SiliconLabs#27
ZPC implementation only Forwarded: SiliconLabs#27 Bug-SiliconLabs: UIC-3068 Bug-Github: SiliconLabs#27
ZPC implementation only Forwarded: SiliconLabs#27 Bug-SiliconLabs: UIC-3067 Bug-Github: SiliconLabs#27
Forwarded: SiliconLabs#27 Bug-SiliconLabs: UIC-3042 Bug-Github: SiliconLabs#27
@@ -723,6 +723,16 @@ static sl_status_t | |||
if (frame_length >= (current_index + 2)) { | |||
next_id = (configuration_parameter_id_t)((frame[current_index] << 8) | |||
| frame[current_index + 1]); | |||
if (next_id == parameter_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't there be the same issue if a device report a next parameter number lower than the current?
if (next_id == parameter_id) { | |
if (next_id <= parameter_id) { |
And of course also adjust the log message.
When 'Parameter Number' and 'Next Parameter Number' are equal, configuration parameter discovery can not complete.
For example, this RX Z-Wave frame will set Node Interview into an infinite loop:
70 : COMMAND_CLASS_CONFIGURATION
0F : CONFIGURATION_PROPERTIES_REPORT_V4
00 : Parameter Number 1 (MSB)
71 : Parameter Number 2 (LSB)
09 : Format 0x01 Unsigned Integer, size 0x1
01 : Min Value
64 : Max Value
0A : Default Value
00 : Next Parameter Number (MSB)
71 : Next Parameter Number (LSB)
02 : No Bulk support 0x1, Not Advanced Parameter 0x0
Change
Detect case when next and current parameter numbers match and exit discovery loop.
Checklist