psyc_render_list: check validity of inputs

This commit is contained in:
psyc://loupsycedyglgamf.onion/~lynX 2017-01-05 21:51:39 +00:00
parent 4d0d0bb9b6
commit 8fe9264b7e
1 changed files with 2 additions and 0 deletions

View File

@ -85,9 +85,11 @@ psyc_render_list (PsycList *list, char *buffer, size_t buflen)
{
size_t i, cur = 0;
ASSERT(NULL != list);
if (list->length > buflen) // return error if list doesn't fit in buffer
return PSYC_RENDER_ERROR;
ASSERT(NULL != buffer);
if (list->type.length) {
memcpy(buffer + cur, PSYC_S2ARG(list->type));
cur += list->type.length;