Do not pass vouchers shorter than 5 characters to voucher application, they

are too short to be a valid voucher.

Discussed with:		Jim P
Issue:			#4985
This commit is contained in:
Luiz Otavio O Souza 2015-09-22 07:45:22 -05:00
parent 670a33c5dc
commit 9fcbc9ffe3

View File

@ -258,7 +258,8 @@ function voucher_expire($voucher_received) {
// Roll# and Ticket# using the external readvoucher binary
foreach ($a_vouchers_received as $voucher) {
$v = escapeshellarg($voucher);
if (strlen($voucher) < 3) {
if (strlen($voucher) < 5) {
captiveportal_syslog("${voucher} invalid: Too short!");
continue; // seems too short to be a voucher!
}
@ -391,7 +392,7 @@ function voucher_auth($voucher_received, $test = 0) {
// Roll# and Ticket# using the external readvoucher binary
foreach ($a_vouchers_received as $voucher) {
$v = escapeshellarg($voucher);
if (strlen($voucher) < 3) {
if (strlen($voucher) < 5) {
$test_result[] = "{$voucher} invalid: Too short!";
captiveportal_syslog("{$voucher} invalid: Too short!");
$error++;