Fixed issue #412 adding a check on Topic's string length in processPublish

This commit is contained in:
andsel
2018-06-28 23:26:56 +02:00
parent 1aa6d9ca93
commit 5e4c70edce
4 changed files with 31 additions and 25 deletions
@@ -72,6 +72,10 @@ public class Topic implements Serializable {
}
private List<Token> parseTopic(String topic) throws ParseException {
if (topic.length() == 0) {
throw new ParseException("Bad format of topic, topic MUST be at least 1 character [MQTT-4.7.3-1] and " +
"this was empty", 0);
}
List<Token> res = new ArrayList<>();
String[] splitted = topic.split("/");