From 94df17720e0db3f6e1b35421ca599b1c2d7b2704 Mon Sep 17 00:00:00 2001 From: Mark Cheverton Date: Fri, 29 Nov 2013 00:18:55 +0000 Subject: [PATCH] Added check for valid QOS (0 or 1) --- PubSubClient/PubSubClient.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PubSubClient/PubSubClient.cpp b/PubSubClient/PubSubClient.cpp index 53380bb..27f37a6 100755 --- a/PubSubClient/PubSubClient.cpp +++ b/PubSubClient/PubSubClient.cpp @@ -306,6 +306,9 @@ boolean PubSubClient::subscribe(char* topic) { } boolean PubSubClient::subscribe(char* topic, uint8_t qos) { + if (qos < 0 || qos > 1) + return false; + if (connected()) { // Leave room in the buffer for header and variable length field uint16_t length = 5;