mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-25 09:16:20 +00:00
altcp_tls_mbedtls_mem: fix compiling for sizeof(mem_size_t) < sizeof(size_t)
This commit is contained in:
parent
d71653f049
commit
1ddb125e2c
@ -188,7 +188,13 @@ altcp_mbedtls_free(void *conf, altcp_mbedtls_state_t *state)
|
|||||||
void *
|
void *
|
||||||
altcp_mbedtls_alloc_config(size_t size)
|
altcp_mbedtls_alloc_config(size_t size)
|
||||||
{
|
{
|
||||||
void *ret = (altcp_mbedtls_state_t *)mem_malloc(size);
|
void *ret;
|
||||||
|
size_t checked_size = (mem_size_t)size;
|
||||||
|
if (size != checked_size) {
|
||||||
|
/* allocation too big (mem_size_t overflow) */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ret = (altcp_mbedtls_state_t *)mem_malloc((mem_size_t)size);
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
memset(ret, 0, size);
|
memset(ret, 0, size);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user