Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/WebRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ void AsyncWebServerRequest::requestAuthentication(AsyncAuthType method, const ch
case AsyncAuthType::AUTH_BASIC:
{
String header;
if (header.reserve(strlen(T_BASIC_REALM) + strlen(realm) + 1)) {
if (header.reserve(sizeof(T_BASIC_REALM) - 1 + strlen(realm) + 1)) {
header.concat(T_BASIC_REALM);
header.concat(realm);
header.concat('"');
Expand All @@ -1015,7 +1015,7 @@ void AsyncWebServerRequest::requestAuthentication(AsyncAuthType method, const ch
}
case AsyncAuthType::AUTH_DIGEST:
{
size_t len = strlen(T_DIGEST_) + strlen(T_realm__) + strlen(T_auth_nonce) + 32 + strlen(T__opaque) + 32 + 1;
size_t len = sizeof(T_DIGEST_) - 1 + sizeof(T_realm__) - 1 + sizeof(T_auth_nonce) - 1 + 32 + sizeof(T__opaque) - 1 + 32 + 1;
String header;
if (header.reserve(len + strlen(realm))) {
const String nonce = genRandomMD5();
Expand Down
4 changes: 2 additions & 2 deletions src/WebResponses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ AsyncFileResponse::AsyncFileResponse(FS &fs, const String &path, const char *con
int filenameStart = path.lastIndexOf('/') + 1;
const char *filename = path.c_str() + filenameStart;
String buf;
buf.reserve(strlen(T_attachment) + strlen(filename) + 2);
buf.reserve(sizeof(T_attachment) - 1 + strlen(filename) + 2);
buf = T_attachment;
buf += filename;
buf += "\"";
Expand Down Expand Up @@ -794,7 +794,7 @@ AsyncFileResponse::AsyncFileResponse(File content, const String &path, const cha
int filenameStart = path.lastIndexOf('/') + 1;
const char *filename = path.c_str() + filenameStart;
String buf;
buf.reserve(strlen(T_attachment) + strlen(filename) + 2);
buf.reserve(sizeof(T_attachment) - 1 + strlen(filename) + 2);
buf = T_attachment;
buf += filename;
buf += "\"";
Expand Down
Loading