mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 09:04:22 +01:00
Add header guard around malloc(0) returning NULL implementation
Make it safe to import the config multiple times without having multiple definition errors. (This prevents errors in the fuzzers in a later patch.) Signed-off-by: Daniel Axtens <dja@axtens.net>
This commit is contained in:
parent
23ea2c6c00
commit
b3f25b06e0
@ -24,6 +24,8 @@
|
|||||||
#include "mbedtls/config.h"
|
#include "mbedtls/config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifndef MBEDTLS_PLATFORM_STD_CALLOC
|
||||||
static inline void *custom_calloc( size_t nmemb, size_t size )
|
static inline void *custom_calloc( size_t nmemb, size_t size )
|
||||||
{
|
{
|
||||||
if( nmemb == 0 || size == 0 )
|
if( nmemb == 0 || size == 0 )
|
||||||
@ -33,5 +35,6 @@ static inline void *custom_calloc( size_t nmemb, size_t size )
|
|||||||
|
|
||||||
#define MBEDTLS_PLATFORM_MEMORY
|
#define MBEDTLS_PLATFORM_MEMORY
|
||||||
#define MBEDTLS_PLATFORM_STD_CALLOC custom_calloc
|
#define MBEDTLS_PLATFORM_STD_CALLOC custom_calloc
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* MBEDTLS_CONFIG_H */
|
#endif /* MBEDTLS_CONFIG_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user