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: