Skip to content

Commit

Permalink
GH-26: Fix infinite loop on invalid next configuration parameter.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
nkljajic authored and rzr committed Aug 5, 2024
1 parent ec2815a commit 1daacdf
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
sl_log_debug(LOG_TAG,
"NodeID %d:%d reports that next parameter number %d"
"equals the current one %d, ignoring.",
info->remote.node_id,
info->remote.endpoint_id,
next_id,
parameter_id);
next_id = 0;
}
// Indicate the next parameter to search for:
attribute_store_set_desired(next_id_node, &next_id, sizeof(next_id));
// Set the reported, then undefine it so the resolver tries a new get immediately.
Expand Down Expand Up @@ -1616,4 +1626,4 @@ sl_status_t zwave_command_class_configuration_init()
zwave_command_handler_register_handler(handler);

return SL_STATUS_OK;
}
}

0 comments on commit 1daacdf

Please sign in to comment.