summaryrefslogtreecommitdiffstats
path: root/pb_encode.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-10-20 21:42:00 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-10-20 21:42:00 +0300
commite83fbd18d3fa33af8a57198cddefe5fcef1b2f58 (patch)
treedcb35036e79df9e2828b51e9158544ad793098c1 /pb_encode.c
parent388d4de833cf4e2127b2ab0489cb6b14ecc0cbb5 (diff)
Check array max size when encoding.
Update issue 90 Status: FixedInGit
Diffstat (limited to 'pb_encode.c')
-rw-r--r--pb_encode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pb_encode.c b/pb_encode.c
index d6ba7e34..4aced3cb 100644
--- a/pb_encode.c
+++ b/pb_encode.c
@@ -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)