diff --git a/src/protocols/HTTP/HTTP.cpp b/src/protocols/HTTP/HTTP.cpp index 9200acb0..00b046d2 100644 --- a/src/protocols/HTTP/HTTP.cpp +++ b/src/protocols/HTTP/HTTP.cpp @@ -140,8 +140,8 @@ int16_t HTTPClient::post(const char* url, const char* content, String& response, } // build the POST request - char contentLengthStr[8]; - itoa(strlen(content), contentLengthStr, 10); + char contentLengthStr[12]; + sprintf(contentLengthStr, "%d", strlen(content)); char* request = new char[strlen(endpoint) + strlen(host) + strlen(contentType) + strlen(contentLengthStr) + strlen(content) + 64 + 1]; strcpy(request, "POST "); strcat(request, endpoint);