From b3d50723b00dfb7e1ee03eb1075e3341c8978fa2 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 26 Oct 2017 09:43:56 +0200 Subject: [PATCH] s3:glock: Move sanity check in g_lock_parse() Signed-off-by: Andreas Schneider Reviewed-by: Volker Lendecke Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Sun Dec 10 00:46:26 CET 2017 on sn-devel-144 --- source3/lib/g_lock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c index c5d66e3855e..50ea56634ba 100644 --- a/source3/lib/g_lock.c +++ b/source3/lib/g_lock.c @@ -74,12 +74,12 @@ static bool g_lock_parse(uint8_t *buf, size_t buflen, struct g_lock *lck) found_recs = IVAL(buf, 0); + buf += sizeof(uint32_t); + buflen -= sizeof(uint32_t); if (found_recs > buflen/G_LOCK_REC_LENGTH) { return false; } - buf += sizeof(uint32_t); - buflen -= sizeof(uint32_t); data_ofs = found_recs * G_LOCK_REC_LENGTH; *lck = (struct g_lock) { -- 2.34.1