Commit dd71c3b
committed
Fix setting identifier truncation in SettingsFrame.serialize_body
The bitmask `setting & 0xFF` truncates the 16-bit setting identifier
to only 8 bits. This silently corrupts any setting ID above 255 during
serialization.
The identifier field in SETTINGS frames is 16 bits wide (RFC 9113,
Section 6.5.1), and `_STRUCT_HL` already uses the `H` format
(unsigned short, 16 bits) for it. However, `& 0xFF` discards the
upper byte.
For the standard settings (0x01 through 0x08) this has no visible
effect since they all fit in 8 bits. But RFC 8701 GREASE values like
0x0a0a or 0x1a1a, as well as any future extension settings > 0xFF,
would be silently mangled on a serialize round-trip.
Change the mask to `& 0xFFFF` to match the actual field width.1 parent b57beaf commit dd71c3b
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
460 | | - | |
| 460 | + | |
461 | 461 | | |
462 | 462 | | |
463 | 463 | | |
| |||
0 commit comments