ccollins476ad commented on a change in pull request #54: img_mgmt: TLVs were 
not getting parsed correctly
URL: https://github.com/apache/mynewt-mcumgr/pull/54#discussion_r357894356
 
 

 ##########
 File path: cmd/img_mgmt/src/img_mgmt.c
 ##########
 @@ -165,7 +165,15 @@ img_mgmt_read_info(int image_slot, struct image_version 
*ver, uint8_t *hash,
      * the hash is missing, the image is considered invalid.
      */
     data_off = hdr.ih_hdr_size + hdr.ih_img_size;
-    rc = img_mgmt_find_tlvs(&hdr, image_slot, &data_off, &data_end);
+
+    rc = img_mgmt_find_tlvs(image_slot, &data_off, &data_end, 
IMAGE_TLV_PROT_INFO_MAGIC);
+    if (rc != 0) {
+        return MGMT_ERR_EUNKNOWN;
+    }
 
 Review comment:
   Some images won't contain protected TLVs (e.g., older ones).  I think the 
code should ignore an error here and only advance the offset on success.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to