mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
cbor: check return value for zero
This commit is contained in:
parent
d783d784c9
commit
f6db56929f
@ -439,6 +439,10 @@ size_t cbor_deserialize_int(const cbor_stream_t *stream, size_t offset, int *val
|
|||||||
uint64_t buf;
|
uint64_t buf;
|
||||||
size_t read_bytes = decode_int(stream, offset, &buf);
|
size_t read_bytes = decode_int(stream, offset, &buf);
|
||||||
|
|
||||||
|
if (!read_bytes) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (CBOR_TYPE(stream, offset) == CBOR_UINT) {
|
if (CBOR_TYPE(stream, offset) == CBOR_UINT) {
|
||||||
*val = buf; /* resolve as CBOR_UINT */
|
*val = buf; /* resolve as CBOR_UINT */
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user