Skip to content

LwM2M: Block transfer with TLV format does not work #34935

@jb-gcx

Description

@jb-gcx

Describe the bug
When writing an opaque resource with block transfer using the TLV format, the first block is received and interpreted correctly. The payload of the second block is interpreted by the code as a new TLV tuple, even though it doesn't repeat the TLV header. This causes the first bytes of the payload in the second block to be interpreted as a TLV header, resulting in an arbitrary type and length.

To Reproduce

  1. Write to an opaque resource using block transfer in TLV format (tested with a Leshan server)
  2. See in the postwrite callback of the resource that it is not received correctly
  3. Modify the payload at the start of the second block to see that the behavior changes depending on those bytes

Expected behavior
Blocks after the first one are properly processed and forwarded to the postwrite callback.

Impact
Block transfer is impossible, making it impossible to write opaque resources with more than 1024 bytes.

Environment (please complete the following information):

  • OS: MacOS
  • Toolchain: gcc-arm-none-eabi-10-2020-q4-major
  • Commit SHA or Version used: 4ce908a (nordics fork)

Additional context

This same issue seems to have been fixed specifically for the firmware package (5/0/0), see here. But the issue occurs on a custom opaque resource as well.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions