-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Connection Layer
makeClientMetadata truncates the appname using Buffer.subarray() and buffer.toString('utf8'):
Buffer .from(appName, 'utf8') .subarray(0, 128).toString('utf8')
This breaks when encoding a string that has a multi-byte unicode character that straddles the 128th byte in the array because `toString('utf8')' replaces the invalid bytes with the unicode replacement character:
Buffer.byteLength( Buffer .from('€'.repeat(300), 'utf8') .subarray(0, 128) .toString('utf8')) // 129
Acceptance Criteria
Fix our string length truncation so that we never produce a string that's > 128 bytes.