From d5f8a6f423f6bfba706d57459d78046920d61ce5 Mon Sep 17 00:00:00 2001
From: Noel Power <noel.power@suse.com>
Date: Fri, 21 Jan 2022 14:52:53 +0000
Subject: [PATCH 4/6] vfs_fruit: CVE-2021-44142 tweak buffer size check

---
 source3/modules/vfs_fruit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -692,7 +692,7 @@ static bool ad_unpack_xattrs(struct adou
 	 * Ensure the buffer ad->ad_data was allocated by ad_alloc() for an
 	 * ADOUBLE_RSRC type (._ AppleDouble file on-disk).
 	 */
-	if (bufsize != AD_XATTR_MAX_HDR_SIZE) {
+	if (bufsize < AD_DATASZ_DOT_UND || bufsize > AD_XATTR_MAX_HDR_SIZE) {
 		return false;
 	}
 
