boot_serial: Fix compilation due to danling pointer

repos/mcuboot/boot/boot_serial/src/zcbor_decode.c:341:52: error:
     dangling pointer ‘result’ to ‘dummy’ may be used
     [-Werror=dangling-pointer=]
  341 |         state->payload_end = result->value + result->len;
      |                                              ~~~~~~^~~~~
repos/mcuboot/boot/boot_serial/src/zcbor_decode.c:325:37: note: ‘dummy’
     declared here
  325 |                 struct zcbor_string dummy = {};
      |                                     ^~~~~
repos/mcuboot/boot/boot_serial/src/zcbor_decode.c:341:36: error:
     dangling pointer ‘result’ to ‘dummy’ may be used
     [-Werror=dangling-pointer=]
  341 |         state->payload_end = result->value + result->len;
      |                              ~~~~~~^~~~~~~
repos/mcuboot/boot/boot_serial/src/zcbor_decode.c:325:37: note: ‘dummy’
     declared here
  325 |                 struct zcbor_string dummy = {};
      |                                     ^~~~~
cc1: all warnings being treated as errors

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This commit is contained in:
Szymon Janc 2022-06-27 17:01:50 +02:00 committed by David Brown
parent 1cd3196400
commit 1270880d2f
1 changed files with 2 additions and 1 deletions

View File

@ -321,8 +321,9 @@ static bool str_overflow_check(zcbor_state_t *state, struct zcbor_string *result
bool zcbor_bstr_start_decode(zcbor_state_t *state, struct zcbor_string *result)
{
struct zcbor_string dummy;
if (result == NULL) {
struct zcbor_string dummy;
result = &dummy;
}