From f6db56929faf451a9554c2bf556a88f9318e226c Mon Sep 17 00:00:00 2001 From: Lucio Torre Date: Wed, 30 Mar 2016 14:30:15 +0200 Subject: [PATCH] cbor: check return value for zero --- sys/cbor/cbor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/cbor/cbor.c b/sys/cbor/cbor.c index cc50b41175..ff264bcdac 100644 --- a/sys/cbor/cbor.c +++ b/sys/cbor/cbor.c @@ -439,6 +439,10 @@ size_t cbor_deserialize_int(const cbor_stream_t *stream, size_t offset, int *val uint64_t buf; size_t read_bytes = decode_int(stream, offset, &buf); + if (!read_bytes) { + return 0; + } + if (CBOR_TYPE(stream, offset) == CBOR_UINT) { *val = buf; /* resolve as CBOR_UINT */ }