From 2b7fc4780887271a162d57ae2efe8915706262f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 18 Aug 2021 09:43:22 +0200 Subject: [PATCH] Add safety check for unpacked session cookie data --- .../install/files/lib/system/session/SessionHandler.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php index 0cdeb4e337..d51d8229b3 100644 --- a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php +++ b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php @@ -242,6 +242,8 @@ final class SessionHandler extends SingletonFactory )); } $data = \unpack('Cversion/a20sessionId/Ctimestep', $value); + \assert($data['version'] === 1); + \assert(\strlen($data['sessionId']) === 20); $data['sessionId'] = Hex::encode($data['sessionId']); return $data; -- 2.20.1