lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Wed, 30 Dec 2020 13:59:40 +0800
From:   Hongfei Shang <shfwin6@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     Hongfei Shang <shanghongfei@...inos.cn>
Subject: [PATCH] initramfs: fix "Decoding failed"

From: Hongfei Shang <shanghongfei@...inos.cn>

when initrd image file load in memory, it is align to 4 bytes,
so there are may be some padding bytes(<4),
should ignore these padding bytes and handle as normal end

before: (when size of initrd.img is: size%4 = 1, 2 or 3)
"Initramfs unpacking failed: Decoding failed"

after:
no error message

Signed-off-by: Hongfei Shang <shanghongfei@...inos.cn>
---
 lib/decompress_unlz4.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/decompress_unlz4.c b/lib/decompress_unlz4.c
index c0cfcfd486be..7527f1541dfd 100644
--- a/lib/decompress_unlz4.c
+++ b/lib/decompress_unlz4.c
@@ -181,6 +181,14 @@ STATIC inline int INIT unlz4(u8 *input, long in_len,
 				goto exit_2;
 			}
 			inp += chunksize;
+
+			if (size < 4) {
+				unsigned int padding = 0;
+
+				memcpy(&padding, inp, size);
+				if (padding == 0)
+					break;
+			}
 		}
 	}
 
-- 
2.25.1

Powered by blists - more mailing lists