mirror of
https://github.com/Yubico/yubikey-ksm.git
synced 2025-01-19 16:52:16 +01:00
First test for parameter, then use it
One should test if a parameter exists before using it instead of letting the PHP auto-type conversion magic have its way with it.
This commit is contained in:
parent
cc6b292fe0
commit
fff4394ca7
@ -34,11 +34,11 @@ require_once 'ykksm-utils.php';
|
|||||||
openlog("ykksm", LOG_PID, $logfacility)
|
openlog("ykksm", LOG_PID, $logfacility)
|
||||||
or die("ERR Syslog open error\n");
|
or die("ERR Syslog open error\n");
|
||||||
|
|
||||||
$otp = $_REQUEST["otp"];
|
if (!isset($_REQUEST["otp"])) {
|
||||||
if (!$otp) {
|
|
||||||
syslog(LOG_INFO, "No OTP provided");
|
syslog(LOG_INFO, "No OTP provided");
|
||||||
die("ERR No OTP provided\n");
|
die("ERR Invalid OTP format\n");
|
||||||
}
|
}
|
||||||
|
$otp = $_REQUEST["otp"];
|
||||||
|
|
||||||
if (!preg_match("/^([cbdefghijklnrtuv]{0,16})([cbdefghijklnrtuv]{32})$/",
|
if (!preg_match("/^([cbdefghijklnrtuv]{0,16})([cbdefghijklnrtuv]{32})$/",
|
||||||
$otp, $matches)) {
|
$otp, $matches)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user