You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2020/02/29 01:12:29 UTC

[mynewt-imgmod] 04/08: image addsig: Allow sig type to be in hexadecimal

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

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

commit 296fca75b9a0504469dd79b2749b1465dc88dd2d
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Fri Feb 28 16:24:28 2020 -0800

    image addsig: Allow sig type to be in hexadecimal
---
 cli/image_cmds.go | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/cli/image_cmds.go b/cli/image_cmds.go
index 9dcb171..a4ea984 100644
--- a/cli/image_cmds.go
+++ b/cli/image_cmds.go
@@ -372,9 +372,8 @@ func runAddsigCmd(cmd *cobra.Command, args []string) {
 	keyFilename := args[1]
 	sigFilename := args[2]
 
-	sigType, err := strconv.Atoi(args[3])
-	if err != nil || sigType < 0 || sigType > 255 ||
-		!image.ImageTlvTypeIsSig(uint8(sigType)) {
+	sigType, err := strconv.ParseUint(args[3], 0, 8)
+	if err != nil || !image.ImageTlvTypeIsSig(uint8(sigType)) {
 
 		ImgmodUsage(cmd, errors.Errorf("invalid signature type: %s", args[3]))
 	}