You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/12/14 03:39:01 UTC

[GitHub] [mynewt-mcumgr] ccollins476ad commented on a change in pull request #54: img_mgmt: TLVs were not getting parsed correctly

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_r357894403
 
 

 ##########
 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;
+    }
+
+    data_off = data_end - sizeof(struct image_tlv_info);
 
 Review comment:
   Personally I would add a brief comment here explaining that the semantics are different for protected TLV info vs unprotected.  It might look like a bug since the code only does this subtraction in one of two places.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services