From 7c25db5bf36191c569513eca0ad7c0dd01c0d25f Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Fri, 30 Dec 2022 13:47:20 +0100 Subject: [PATCH] bitlk: fix possible leak of description If metdata contains more than one description fields, use just the first one. Fixes OSS-fuzz bug 54682. --- lib/bitlk/bitlk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bitlk/bitlk.c b/lib/bitlk/bitlk.c index c0a1db98..2fea6f97 100644 --- a/lib/bitlk/bitlk.c +++ b/lib/bitlk/bitlk.c @@ -701,7 +701,7 @@ int BITLK_read_sb(struct crypt_device *cd, struct bitlk_metadata *params) params->volume_header_offset = le64_to_cpu(entry_header.offset); params->volume_header_size = le64_to_cpu(entry_header.size); /* volume description (utf-16 string) */ - } else if (entry_type == BITLK_ENTRY_TYPE_DESCRIPTION) { + } else if (entry_type == BITLK_ENTRY_TYPE_DESCRIPTION && !params->description) { if (entry_size < BITLK_ENTRY_HEADER_LEN) { r = -EINVAL; goto out;