Fix to allow more than one certificate to be loaded (espressif#3248). (#4056)

Co-authored-by: Mark Hale <mark.hale@physics.org>
This commit is contained in:
pulquero 2020-09-30 13:19:41 +01:00 committed by GitHub
parent f48d9016fd
commit 11d071b1c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -274,18 +274,16 @@ bool WiFiClientSecure::verify(const char* fp, const char* domain_name)
}
char *WiFiClientSecure::_streamLoad(Stream& stream, size_t size) {
static char *dest = nullptr;
if(dest) {
free(dest);
}
dest = (char*)malloc(size);
char *dest = (char*)malloc(size+1);
if (!dest) {
return nullptr;
}
if (size != stream.readBytes(dest, size)) {
free(dest);
dest = nullptr;
return nullptr;
}
dest[size] = '\0';
return dest;
}