Skip to content

Commit 49ef3f8

Browse files
Pretty: fix use of uninitialised variable
The string chunk getter doesn't set ptr if there was an error decoding. Instead, we need to deal with the error first. Signed-off-by: Thiago Macieira <[email protected]>
1 parent 587ff53 commit 49ef3f8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/cborpretty.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************************
22
**
3-
** Copyright (C) 2018 Intel Corporation
3+
** Copyright (C) 2019 Intel Corporation
44
**
55
** Permission is hereby granted, free of charge, to any person obtaining a copy
66
** of this software and associated documentation files (the "Software"), to deal
@@ -422,6 +422,8 @@ static CborError value_to_pretty(CborStreamFunction stream, void *out, CborValue
422422
}
423423

424424
err = _cbor_value_get_string_chunk(it, &ptr, &n, it);
425+
if (err)
426+
return err;
425427
if (!ptr)
426428
break;
427429

0 commit comments

Comments
 (0)