Skip to content

fix: return the correct attribute count on partial attribute-list responses#597

Open
MrAlaskan wants to merge 1 commit into
EIPStackGroup:masterfrom
MrAlaskan:fix/cipcommon-partial-transfer-attribute-count
Open

fix: return the correct attribute count on partial attribute-list responses#597
MrAlaskan wants to merge 1 commit into
EIPStackGroup:masterfrom
MrAlaskan:fix/cipcommon-partial-transfer-attribute-count

Conversation

@MrAlaskan

Copy link
Copy Markdown

Summary

This PR fixes the attribute count returned by GetAttributeList() and SetAttributeList() when the response is truncated with PartialTransfer.

Problem

Both GetAttributeList() and SetAttributeList() reserve space for the attribute count field at the beginning of the response and later backfill it after processing the requested attributes. However, when either service detects that the remaining response buffer is too small and returns kCipErrorPartialTransfer, it currently writes back attribute_count_request, which is the number of attributes requested by the client.

This is incorrect for a partial response. In a PartialTransfer case, the attribute count field must describe the number of attribute entries that were actually written into the response, not the total number that were requested. The current implementation therefore produces a response whose declared attribute count can be larger than the number of attribute status entries that actually follow in the payload.

This creates a protocol-format mismatch and can cause clients or conformance tools to misparse the response or reject it as invalid.

Changes

  • Track the number of attribute entries actually written to the response in both GetAttributeList() and SetAttributeList().
  • Backfill the response attribute count with the number of returned entries instead of the original request count.

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