Skip to content

Commit 5ce7e3d

Browse files
committed
SonarQube findings resolution
Null pointers should not be dereferenced. Issue link: https://sonarcloud.io/project/issues?open=AZewUHZMhZlKgxRm5XOd&id=nrfconnect_sdk-mcuboot Ref: NCSDK-35334 Signed-off-by: Adam Szczygieł <[email protected]>
1 parent 8667f22 commit 5ce7e3d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

boot/bootutil/src/tlv.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ bootutil_tlv_iter_next(struct image_tlv_iter *it, uint32_t *off, uint16_t *len,
135135
}
136136

137137
if (it->type == IMAGE_TLV_ANY || tlv.it_type == it->type) {
138-
if (type != NULL) {
139-
*type = tlv.it_type;
140-
}
141138
*off = it->tlv_off + sizeof(tlv);
142139
*len = tlv.it_len;
143140
it->tlv_off += sizeof(tlv) + tlv.it_len;
144-
BOOT_LOG_DBG("bootutil_tlv_iter_next: TLV %d found at %d (size %d)",
145-
*type, *off, *len);
141+
if (type != NULL) {
142+
*type = tlv.it_type;
143+
BOOT_LOG_DBG("bootutil_tlv_iter_next: TLV %d found at %d (size %d)",
144+
*type, *off, *len);
145+
}
146146
return 0;
147147
}
148148

0 commit comments

Comments
 (0)