From 9939910833a9289b5913eff29f951195e7bc61c6 Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Sun, 14 Apr 2013 09:26:42 +0300 Subject: 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 --- pb_decode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pb_decode.c') 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; -- cgit 1.2.3-korg