parser: Set the length to 0 on error in extract_length()
This silences a false-positive compilation warning
[-Werror=maybe-uninitialized] in iterate_string_chunks() that some
variables were used without initialisation.
Fixes #21
Signed-off-by: Mike Colagrosso <colagrosso@users.noreply.github.com>
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
diff --git a/src/cborparser.c b/src/cborparser.c
index ab3cae1..61c378a 100644
--- a/src/cborparser.c
+++ b/src/cborparser.c
@@ -65,8 +65,10 @@
{
uint64_t v;
CborError err = extract_number(ptr, parser->end, &v);
- if (err)
+ if (err) {
+ *len = 0;
return err;
+ }
*len = v;
if (v != *len)