summaryrefslogtreecommitdiffstats
path: root/pb_decode.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2017-03-02 22:14:00 +0200
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2017-03-02 22:21:57 +0200
commit6ea1047a7f868796621f1ec9f7324f101e135733 (patch)
tree3dd7aeb81c2db8da0b4ee35e48a8d6c12c704e7c /pb_decode.c
parent6fca8edc847bc70fd2e9d268af06015f8e64ec15 (diff)
Fix callback pointer corruption in proto3 mode (issue #249)
Diffstat (limited to 'pb_decode.c')
-rw-r--r--pb_decode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pb_decode.c b/pb_decode.c
index a8cd61a7..e2e90caa 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -780,7 +780,7 @@ static void pb_field_set_to_default(pb_field_iter_t *iter)
else if (PB_ATYPE(type) == PB_ATYPE_STATIC)
{
bool init_data = true;
- if (PB_HTYPE(type) == PB_HTYPE_OPTIONAL)
+ if (PB_HTYPE(type) == PB_HTYPE_OPTIONAL && iter->pSize != iter->pData)
{
/* Set has_field to false. Still initialize the optional field
* itself also. */