Procházet zdrojové kódy

cJSON_strdup: Use sizeof("") instead of 1

Max Bruckner před 8 roky
rodič
revize
c784f76c77
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      cJSON.c

+ 1 - 1
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;