summaryrefslogtreecommitdiffstats
path: root/pb_decode.c
diff options
context:
space:
mode:
Diffstat (limited to 'pb_decode.c')
-rw-r--r--pb_decode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/pb_decode.c b/pb_decode.c
index 7c68b5a2..6ddde773 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -39,11 +39,14 @@ static const pb_decoder_t PB_DECODERS[PB_LTYPES_COUNT] = {
static bool checkreturn buf_read(pb_istream_t *stream, uint8_t *buf, size_t count)
{
uint8_t *source = (uint8_t*)stream->state;
+ stream->state = source + count;
if (buf != NULL)
- memcpy(buf, source, count);
+ {
+ while (count--)
+ *buf++ = *source++;
+ }
- stream->state = source + count;
return true;
}