Selaa lähdekoodia

ensure: Fix potential off by one error.

Max Bruckner 8 vuotta sitten
vanhempi
commit
cc84a446be
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      cJSON.c

+ 1 - 1
cJSON.c

@@ -259,7 +259,7 @@ static unsigned char* ensure(printbuffer * const p, size_t needed, const interna
         return NULL;
     }
 
-    needed += p->offset;
+    needed += p->offset + 1;
     if (needed <= p->length)
     {
         return p->buffer + p->offset;