Add safety check for unpacked session cookie data
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 18 Aug 2021 07:43:22 +0000 (09:43 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 18 Aug 2021 07:56:55 +0000 (09:56 +0200)
wcfsetup/install/files/lib/system/session/SessionHandler.class.php

index 0cdeb4e337069d5ff2b9ea606b5e5e8ed0f985d1..d51d8229b3612a21791c9a251c1ecce54d83d129 100644 (file)
@@ -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;