summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-03-09 13:12:09 +0200
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-03-09 13:12:09 +0200
commite1b8a555f30d77a3c0094cf3678666b38f4b4bd3 (patch)
treedc641102abfca3a904d5e9768ecd65a41cba711b
parent60109c0be1c8b21b38f08b50db36577921eaca7f (diff)
Fix additional bug with empty message types.
pb_field_next() would access past the fields array.
-rw-r--r--pb_decode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pb_decode.c b/pb_decode.c
index e2e89a0d..fba8f64c 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -312,6 +312,9 @@ static bool pb_field_next(pb_field_iterator_t *iter)
if (PB_HTYPE(iter->current->type) == PB_HTYPE_REQUIRED)
iter->required_field_index++;
+ if (iter->current->tag == 0)
+ return false; /* Only happens with empty message types */
+
iter->current++;
iter->field_index++;
if (iter->current->tag == 0)