Skip to content

Commit 74539bd

Browse files
authored
Merge pull request from GHSA-2m59-c483-c8qj
Disallow submitting more than four flights in a single request
2 parents 2d76df9 + 91f8893 commit 74539bd

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

openflights.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3867,6 +3867,7 @@ function selectAirport(apid, select, quick, code) {
38673867
function changeRows(type) {
38683868
switch (type) {
38693869
case "More":
3870+
// NOTE: also change the limit in submit.php to support more flights in a single request
38703871
if (multiinput_rows >= 3) {
38713872
$("b_more").disabled = true;
38723873
}

php/submit.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
$mode = $_POST["mode"];
2424
$note = stripslashes($_POST["note"]);
2525
$param = $_POST["param"];
26-
$multi = $_POST["multi"] ?? false;
26+
$multi = intval($_POST["multi"]);
2727

2828
if (!$mode || $mode == "") {
2929
$mode = "F";
@@ -83,8 +83,8 @@
8383
$num_added = 0;
8484
switch ($param) {
8585
case "ADD":
86-
// Can add multiple flights or just one
87-
if ($multi) {
86+
// Can add multiple (at most 4) flights or just one
87+
if ($multi >= 1 && $multi <= 4) {
8888
for ($idx = 0; $idx < $multi; $idx++) {
8989
$rows[$idx] = $idx + 1;
9090
}

0 commit comments

Comments
 (0)