From d6d517a2b89566247854ec8d826ef78d948e4103 Mon Sep 17 00:00:00 2001
From: Georg Ringer <georg.ringer@gmail.com>
Date: Fri, 26 May 2023 08:23:45 +0200
Subject: [PATCH] [BUGFIX] Cast IP lock settings to int
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Avoid exceptions by casting the values to integers.

Resolves: #100916
Releases: main, 12.4, 11.5
Change-Id: Icb1eeef44b11f3134bec2b5cb036049c8cfbd620
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79147
Reviewed-by: Nikita Hovratov <nikita.h@live.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Thomas Hohn <tho@gyldendal.dk>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: Nikita Hovratov <nikita.h@live.de>
Reviewed-by: Stefan Froemken <froemken@gmail.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Stefan Froemken <froemken@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
---
 typo3/sysext/core/Classes/Session/UserSessionManager.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/core/Classes/Session/UserSessionManager.php b/typo3/sysext/core/Classes/Session/UserSessionManager.php
index d670aa06d76b..32456a07ecb7 100644
--- a/typo3/sysext/core/Classes/Session/UserSessionManager.php
+++ b/typo3/sysext/core/Classes/Session/UserSessionManager.php
@@ -360,8 +360,8 @@ class UserSessionManager implements LoggerAwareInterface
         $sessionManager = $sessionManager ?? GeneralUtility::makeInstance(SessionManager::class);
         $ipLocker = $ipLocker ?? GeneralUtility::makeInstance(
             IpLocker::class,
-            $GLOBALS['TYPO3_CONF_VARS'][$loginType]['lockIP'],
-            $GLOBALS['TYPO3_CONF_VARS'][$loginType]['lockIPv6']
+            (int)($GLOBALS['TYPO3_CONF_VARS'][$loginType]['lockIP'] ?? 0),
+            (int)($GLOBALS['TYPO3_CONF_VARS'][$loginType]['lockIPv6'] ?? 0)
         );
         $lifetime = (int)($GLOBALS['TYPO3_CONF_VARS'][$loginType]['lifetime'] ?? 0);
         $sessionLifetime = $sessionLifetime ?? (int)$GLOBALS['TYPO3_CONF_VARS'][$loginType]['sessionTimeout'];
-- 
GitLab