You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2022/07/01 08:47:44 UTC

[mynewt-mcumgr] branch master updated: cmd/img_mgmt: Fix compilation with dummy hash enabled

This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b03911  cmd/img_mgmt: Fix compilation with dummy hash enabled
4b03911 is described below

commit 4b03911b3a64579f71c17f008582138c550c9ee5
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Mon Jun 27 18:08:05 2022 +0200

    cmd/img_mgmt: Fix compilation with dummy hash enabled
    
    Hash len is 32 bytes.
    
    repos/apache-mynewt-mcumgr/cmd/img_mgmt/src/img_mgmt.c:
         In function ‘img_mgmt_read_info’:
    repos/apache-mynewt-mcumgr/cmd/img_mgmt/src/img_mgmt.c:122:9:
         error: ‘memcpy’ reading 32 bytes from a region of size 16
         [-Werror=stringop-overread]
      122 |         memcpy(hash, dummy_hash, IMG_MGMT_HASH_LEN);
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    repos/apache-mynewt-mcumgr/cmd/img_mgmt/src/img_mgmt.c:114:13:
         note: source object ‘dummy_hash’ of size 16
      114 |     uint8_t dummy_hash[] = {0x00, 0x11, 0x22, 0x33,
                                        0x44, 0x55, 0x66, 0x77,
          |             ^~~~~~~~~~
    cc1: all warnings being treated as errors
---
 cmd/img_mgmt/src/img_mgmt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cmd/img_mgmt/src/img_mgmt.c b/cmd/img_mgmt/src/img_mgmt.c
index 6e28906..d582dbd 100644
--- a/cmd/img_mgmt/src/img_mgmt.c
+++ b/cmd/img_mgmt/src/img_mgmt.c
@@ -112,6 +112,8 @@ img_mgmt_read_info(int image_slot, struct image_version *ver, uint8_t *hash,
 
 #if IMG_MGMT_DUMMY_HDR
     uint8_t dummy_hash[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
+                            0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
+                            0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
                             0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77};
 
     if (!hash && !ver && !flags) {