Преглед изворни кода

ensure: Fix potential off by one error.

Max Bruckner пре 8 година
родитељ
комит
cc84a446be
1 измењених фајлова са 1 додато и 1 уклоњено
  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;