diff mbox series

[meta-swupdate] Backport Fix for IVT check BUG into release 2023.12.1

Message ID 20240312162758.374602-1-ayoub.zaki@embetrix.com
State Accepted
Headers show
Series [meta-swupdate] Backport Fix for IVT check BUG into release 2023.12.1 | expand

Commit Message

Ayoub Zaki March 12, 2024, 4:27 p.m. UTC
Patch Cherry-picked from:

https://github.com/sbabic/swupdate/commit/fee1c3febbb45bdc691c1fde79f537cdfc74ffc5

On the console the reported swupdate version will be:

$ swupdate --version
SWUpdate v2023.12.1-dirty

Signed-off-by: Ayoub Zaki <ayoub.zaki@embetrix.com>
---
 .../0001-BUG-regression-checking-IVT.patch    | 34 +++++++++++++++++++
 .../swupdate/swupdate_2023.12.1.bb            |  2 ++
 2 files changed, 36 insertions(+)
 create mode 100644 recipes-support/swupdate/swupdate/0001-BUG-regression-checking-IVT.patch
diff mbox series

Patch

diff --git a/recipes-support/swupdate/swupdate/0001-BUG-regression-checking-IVT.patch b/recipes-support/swupdate/swupdate/0001-BUG-regression-checking-IVT.patch
new file mode 100644
index 0000000..b3e0bde
--- /dev/null
+++ b/recipes-support/swupdate/swupdate/0001-BUG-regression-checking-IVT.patch
@@ -0,0 +1,34 @@ 
+From fee1c3febbb45bdc691c1fde79f537cdfc74ffc5 Mon Sep 17 00:00:00 2001
+From: Stefano Babic <stefano.babic@swupdate.org>
+Date: Mon, 19 Feb 2024 19:05:29 +0100
+Subject: [PATCH] BUG: regression checking IVT
+
+e48a866542 creates a regression bug. A valid IVT pointer is always
+passed because it is generally a zeroed array of chars, so passing null
+length string is a valid case and not an error, and in that case the IVT
+from the file should be taken.
+
+Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
+Signed-off-by: Ayoub Zaki <ayoub.zaki@embetrix.com>
+---
+ core/cpio_utils.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/core/cpio_utils.c b/core/cpio_utils.c
+index e5de2a7..7948dc2 100644
+--- a/core/cpio_utils.c
++++ b/core/cpio_utils.c
+@@ -514,8 +514,8 @@ static int __swupdate_copy(int fdin, unsigned char *inbuf, void *out, size_t nby
+ 
+ 	if (encrypted) {
+ 		aes_key = get_aes_key();
+-		if (imgivt) {
+-			if (!strlen(imgivt) || !is_hex_str(imgivt) || ascii_to_bin(ivtbuf, sizeof(ivtbuf), imgivt)) {
++		if (imgivt && strlen(imgivt)) {
++			if (!is_hex_str(imgivt) || ascii_to_bin(ivtbuf, sizeof(ivtbuf), imgivt)) {
+ 				ERROR("Invalid image ivt");
+ 				return -EINVAL;
+ 			}
+-- 
+2.34.1
+
diff --git a/recipes-support/swupdate/swupdate_2023.12.1.bb b/recipes-support/swupdate/swupdate_2023.12.1.bb
index 4eee687..bc9b641 100644
--- a/recipes-support/swupdate/swupdate_2023.12.1.bb
+++ b/recipes-support/swupdate/swupdate_2023.12.1.bb
@@ -1,3 +1,5 @@ 
 require swupdate.inc
 
+SRC_URI += "file://0001-BUG-regression-checking-IVT.patch"
+
 SRCREV = "66952eff1a30701686723ff2fab0576b389620db"