From 1d73531fdbb5b231c18542f4a9e70abde4fb9b18 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 13 Sep 2018 01:04:40 +0300 Subject: [PATCH] HS 2.0: Fix T&C server database check It was possible for the wait loop to exit early due to the $row[0] == 1 check returning false if the database value was not yet set. Fix this by updated the $waiting default value only if the database actually has a value for this field. Signed-off-by: Jouni Malinen --- hs20/server/www/terms.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hs20/server/www/terms.php b/hs20/server/www/terms.php index e360be5f4..e269b3cd3 100644 --- a/hs20/server/www/terms.php +++ b/hs20/server/www/terms.php @@ -59,8 +59,10 @@ if (!$accept) { if (!$row) { die("No current session for the specified MAC address"); } - $waiting = $row[0] == 1; - $ack = $row[1] == 1; + if (strlen($row[0]) > 0) + $waiting = $row[0] == 1; + if (strlen($row[1]) > 0) + $ack = $row[1] == 1; $res->closeCursor(); if (!$waiting) break;