Skip to content

Commit b18b91c

Browse files
committed
boot: boot_serial: Fix uninitialised variables for upload
Fixes some issues whereby some variables were not initialised, and undefined values were wrongly used instead Signed-off-by: Jamie McCrae <[email protected]>
1 parent 1da18e9 commit b18b91c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

boot/boot_serial/src/boot_serial.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,8 @@ bs_set(char *buf, int len)
452452
uint8_t image_index = 0;
453453
size_t decoded = 0;
454454
uint8_t hash[IMAGE_HASH_SIZE];
455-
bool confirm;
456-
struct zcbor_string img_hash;
455+
bool confirm = false;
456+
struct zcbor_string img_hash = { 0 };
457457
bool ok;
458458
int rc;
459459

@@ -798,7 +798,7 @@ bs_upload(char *buf, int len)
798798
size_t img_size_tmp = SIZE_MAX; /* Temp variable for image size */
799799
const struct flash_area *fap = NULL;
800800
int rc;
801-
struct zcbor_string img_chunk_data;
801+
struct zcbor_string img_chunk_data = { 0 };
802802
size_t decoded = 0;
803803
bool ok;
804804
#ifdef MCUBOOT_ERASE_PROGRESSIVELY
@@ -1021,7 +1021,7 @@ bs_upload(char *buf, int len)
10211021
}
10221022
}
10231023
} else {
1024-
out_invalid_data:
1024+
out_invalid_data:
10251025
rc = MGMT_ERR_EINVAL;
10261026
}
10271027

0 commit comments

Comments
 (0)