CoAP Option Offsets and Shifted Boundaries

CoAP Option Offsets and Shifted Boundaries

Try Use Step to check where the next option prefix lands after the first prefix, b7, and its seven value bytes.

Predict where the next CoAP option begins.

CoAP

Original datagram

041
101
212
334
4a1
5b7
673
765
86e
973
106f
1172
1273
1304
1474
1565
166d
1770
Header · offsets 0–3Token · offset 4
Byte pointer
Next prefix · offset 5
Previous complete option number
0

Find the first option prefix

The fixed header and token are accounted for. After reading b7 and its value, where should the next option prefix begin?

Observe In the original datagram, 04 at offset 13 is the next prefix. In the shifted panel, that byte joins the first value and 74 at offset 14 becomes the candidate prefix.
Explain Changing b7 to b8 raises the declared length from 7 to 8, so the first option consumes offset 13 and the next candidate is interpreted from offset 14.

Technical boundaries. The byte strips isolate a single prefix change in a fixed datagram with no payload marker. The replay stops at the incomplete candidate when the declared span runs past the available bytes. Other shifted traces can decode into unintended options.

Back to the chapter