mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
cJSON_strdup: Use sizeof("") instead of 1
This commit is contained in:
parent
84237ff48e
commit
c784f76c77
2
cJSON.c
2
cJSON.c
@ -100,7 +100,7 @@ static unsigned char* cJSON_strdup(const unsigned char* str, const internal_hook
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = strlen((const char*)str) + 1;
|
len = strlen((const char*)str) + sizeof("");
|
||||||
if (!(copy = (unsigned char*)hooks->allocate(len)))
|
if (!(copy = (unsigned char*)hooks->allocate(len)))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user