Check array max size when encoding.

Update issue 90
Status: FixedInGit
This commit is contained in:
Petteri Aimonen
2013-10-20 21:42:00 +03:00
parent 388d4de833
commit e83fbd18d3
2 changed files with 17 additions and 0 deletions

View File

@@ -94,6 +94,9 @@ static bool checkreturn encode_array(pb_ostream_t *stream, const pb_field_t *fie
if (count == 0)
return true;
if (count > field->array_size)
PB_RETURN_ERROR(stream, "array max size exceeded");
/* We always pack arrays if the datatype allows it. */
if (PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)