Matter: encode strings longer than 255 bytes (#25185)

Matter_TLV.tlv2raw() wrote a UTF2 string with bytes().frostring(), a
typo for fromstring(), so encoding any string of more than 255 bytes
(which is given type UTF2 automatically) raised attribute_error.
This commit is contained in:
Adam Matthews authored and GitHub committed 2026-10-23 22:40:50 +02:00
1 parent e1325dd292
commit 06d51e8fc2
1 file changed
+1 -1
@@ -375,7 +375,7 @@ class Matter_TLV
elif self.typ == 0x0D #-TLV.UTF2-# elif self.typ == 0x0D #-TLV.UTF2-#
if size(self.val) > 65535 raise "value_error", "string too big" end if size(self.val) > 65535 raise "value_error", "string too big" end
b.add(size(self.val), 2) b.add(size(self.val), 2)
b..bytes().frostring(str(self.val)) b..bytes().fromstring(str(self.val))
elif self.typ == 0x10 #-TLV.B1-# elif self.typ == 0x10 #-TLV.B1-#
if size(self.val) > 255 raise "value_error", "bytes too big" end if size(self.val) > 255 raise "value_error", "bytes too big" end
b.add(size(self.val), 1) b.add(size(self.val), 1)