Skip to content

Commit

Permalink
ensure: only memcopy what's necessary
Browse files Browse the repository at this point in the history
We don't need to copy the entire printbuffer, only the part that is
required.
  • Loading branch information
FSMaxB committed Feb 18, 2017
1 parent 04d963c commit ccb3e0e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cJSON.c
Expand Up @@ -308,7 +308,7 @@ static unsigned char* ensure(printbuffer *p, size_t needed)
}
if (newbuffer)
{
memcpy(newbuffer, p->buffer, p->length);
memcpy(newbuffer, p->buffer, p->offset + 1);
}
cJSON_free(p->buffer);
}
Expand Down

0 comments on commit ccb3e0e

Please sign in to comment.