summaryrefslogtreecommitdiffstats
path: root/pb_decode.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-04-14 09:26:42 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-04-14 09:26:42 +0300
commit9939910833a9289b5913eff29f951195e7bc61c6 (patch)
tree3455554408cbfec6503f92935732201571c7311f /pb_decode.c
parent6a022985845a0a50b32b7c1fb22f9aee1f675825 (diff)
Fix bug with empty strings in repeated string callbacks.
Fix suggested by Henrik Carlgren. Added also unit test for the bug. Update issue 73 Status: FixedInGit
Diffstat (limited to 'pb_decode.c')
-rw-r--r--pb_decode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pb_decode.c b/pb_decode.c
index 7eda89a4..d0e18ccb 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -430,11 +430,11 @@ static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type
if (!pb_make_string_substream(stream, &substream))
return false;
- while (substream.bytes_left)
+ do
{
if (!pCallback->funcs.decode(&substream, iter->pos, arg))
PB_RETURN_ERROR(stream, "callback failed");
- }
+ } while (substream.bytes_left);
pb_close_string_substream(stream, &substream);
return true;