From f9ad15e85263487fedaa455e9e090d9622fccfde Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Debian Linux)" <rob@synchro.net>
Date: Sat, 21 Dec 2024 14:40:46 -0800
Subject: [PATCH] Fix off-by-one error in date/time field bit-mask calculation

This became apparent when the the LSB of the day got set (an odd
day). Oops.

This only impacted decoding of date/time, not encoding.
---
 src/smblib/smbdefs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/smblib/smbdefs.h b/src/smblib/smbdefs.h
index 899575e904..6c289c0e5d 100644
--- a/src/smblib/smbdefs.h
+++ b/src/smblib/smbdefs.h
@@ -368,7 +368,7 @@ typedef struct {		/* Time with time-zone */
 } when_t;
 
 // We encode Month/Day/Hour/Min/Sec into 26 bits:
-#define SMB_DATE_MK_MASK(width, shift)	(((1 << (width + 1)) - 1) << shift)
+#define SMB_DATE_MK_MASK(width, shift)	(((1 << (width)) - 1) << shift)
 #define SMB_DATE_MON_SHIFT		22
 #define SMB_DATE_MON_MASK		SMB_DATE_MK_MASK(4, SMB_DATE_MON_SHIFT)
 #define SMB_DATE_DAY_SHIFT		17
-- 
GitLab