Skip to content

Commit aaa70d2

Browse files
committed
MQTTv5 - Ignoring control chars between U+D800 and U+DFFF
Signed-off-by: James Sutton <james.sutton@uk.ibm.com>
1 parent 7043ecd commit aaa70d2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • org.eclipse.paho.mqttv5.common/src/main/java/org/eclipse/paho/mqttv5/common/packet

org.eclipse.paho.mqttv5.common/src/main/java/org/eclipse/paho/mqttv5/common/packet/MqttDataTypes.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ public static String decodeUTF8(DataInputStream input) throws MqttException {
170170
private static void validateUTF8String(String input) throws IllegalArgumentException {
171171
for (int i = 0; i < input.length(); i++) {
172172
char c = input.charAt(i);
173-
if (Character.getType(c) == Character.CONTROL || Character.getType(c) == Character.UNASSIGNED) {
173+
if (Character.getType(c) == Character.CONTROL ||
174+
Character.getType(c) == Character.UNASSIGNED ||
175+
Character.getType(c) == Character.SURROGATE) {
174176
throw new IllegalArgumentException(String.format("Invalid UTF-8 char: %s [%s]", c, (int) c));
175177
}
176178
}

0 commit comments

Comments
 (0)