From 719b90eafd46b2f97067730dacbab7c49e7fd5e9 Mon Sep 17 00:00:00 2001 From: Abderraouf Adjal Date: Thu, 22 Aug 2019 17:14:02 +0100 Subject: [PATCH] PubSubClient.h: Using strnlen() --- src/PubSubClient.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PubSubClient.h b/src/PubSubClient.h index 2fd6f1d..9a4b72f 100755 --- a/src/PubSubClient.h +++ b/src/PubSubClient.h @@ -83,7 +83,7 @@ #define MQTT_CALLBACK_SIGNATURE void (*callback)(char*, uint8_t*, unsigned int) #endif -#define CHECK_STRING_LENGTH(l,s) if (l+2+strlen(s) > MQTT_MAX_PACKET_SIZE) {_client->stop();return false;} +#define CHECK_STRING_LENGTH(l,s) if (l+2+strnlen(s, MQTT_MAX_PACKET_SIZE) > MQTT_MAX_PACKET_SIZE) {_client->stop();return false;} class PubSubClient : public Print { private: