Skip to content

Commit

Permalink
Merge pull request from GHSA-2m59-c483-c8qj
Browse files Browse the repository at this point in the history
Disallow submitting more than four flights in a single request
  • Loading branch information
jpatokal authored Feb 1, 2024
2 parents 2d76df9 + 91f8893 commit 74539bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions openflights.js
Original file line number Diff line number Diff line change
Expand Up @@ -3867,6 +3867,7 @@ function selectAirport(apid, select, quick, code) {
function changeRows(type) {
switch (type) {
case "More":
// NOTE: also change the limit in submit.php to support more flights in a single request
if (multiinput_rows >= 3) {
$("b_more").disabled = true;
}
Expand Down
6 changes: 3 additions & 3 deletions php/submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
$mode = $_POST["mode"];
$note = stripslashes($_POST["note"]);
$param = $_POST["param"];
$multi = $_POST["multi"] ?? false;
$multi = intval($_POST["multi"]);

if (!$mode || $mode == "") {
$mode = "F";
Expand Down Expand Up @@ -83,8 +83,8 @@
$num_added = 0;
switch ($param) {
case "ADD":
// Can add multiple flights or just one
if ($multi) {
// Can add multiple (at most 4) flights or just one
if ($multi >= 1 && $multi <= 4) {
for ($idx = 0; $idx < $multi; $idx++) {
$rows[$idx] = $idx + 1;
}
Expand Down

0 comments on commit 74539bd

Please sign in to comment.