summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@netgate.com>2019-05-28 14:00:25 -0400
committerjim-p <jimp@netgate.com>2019-05-28 14:00:43 -0400
commit89b123fb3d46f300369b663e236d5f1808ef26f5 (patch)
treeec7668502fbabaffcbc73a180ac32d235374e743
parentf8560a14e9fb41631a51dce552a0342a84d5b1f6 (diff)
downloadpfsense-89b123fb3d46f300369b663e236d5f1808ef26f5.zip
pfsense-89b123fb3d46f300369b663e236d5f1808ef26f5.tar.gz
Ensure NTP values are treated as numbers before use. Fixes #9558
(cherry picked from commit c92dbfc189ee4cc66726d817f47e5473f8ffe147)
-rw-r--r--src/usr/local/www/status_ntpd.php16
-rw-r--r--src/usr/local/www/widgets/widgets/ntp_status.widget.php16
2 files changed, 16 insertions, 16 deletions
diff --git a/src/usr/local/www/status_ntpd.php b/src/usr/local/www/status_ntpd.php
index 316f723..53ece73 100644
--- a/src/usr/local/www/status_ntpd.php
+++ b/src/usr/local/www/status_ntpd.php
@@ -115,9 +115,9 @@ if ($allow_query) {
$gps_lat_min = substr($gps_vars[3], 2);
$gps_lon_deg = substr($gps_vars[5], 0, 3);
$gps_lon_min = substr($gps_vars[5], 3);
- $gps_lat = $gps_lat_deg + $gps_lat_min / 60.0;
+ $gps_lat = (float) $gps_lat_deg + $gps_lat_min / 60.0;
$gps_lat = $gps_lat * (($gps_vars[4] == "N") ? 1 : -1);
- $gps_lon = $gps_lon_deg + $gps_lon_min / 60.0;
+ $gps_lon = (float) $gps_lon_deg + $gps_lon_min / 60.0;
$gps_lon = $gps_lon * (($gps_vars[6] == "E") ? 1 : -1);
$gps_lat_dir = $gps_vars[4];
$gps_lon_dir = $gps_vars[6];
@@ -128,9 +128,9 @@ if ($allow_query) {
$gps_lat_min = substr($gps_vars[2], 2);
$gps_lon_deg = substr($gps_vars[4], 0, 3);
$gps_lon_min = substr($gps_vars[4], 3);
- $gps_lat = $gps_lat_deg + $gps_lat_min / 60.0;
+ $gps_lat = (float) $gps_lat_deg + $gps_lat_min / 60.0;
$gps_lat = $gps_lat * (($gps_vars[3] == "N") ? 1 : -1);
- $gps_lon = $gps_lon_deg + $gps_lon_min / 60.0;
+ $gps_lon = (float) $gps_lon_deg + $gps_lon_min / 60.0;
$gps_lon = $gps_lon * (($gps_vars[5] == "E") ? 1 : -1);
$gps_alt = $gps_vars[9];
$gps_alt_unit = $gps_vars[10];
@@ -144,9 +144,9 @@ if ($allow_query) {
$gps_lat_min = substr($gps_vars[1], 2);
$gps_lon_deg = substr($gps_vars[3], 0, 3);
$gps_lon_min = substr($gps_vars[3], 3);
- $gps_lat = $gps_lat_deg + $gps_lat_min / 60.0;
+ $gps_lat = (float) $gps_lat_deg + $gps_lat_min / 60.0;
$gps_lat = $gps_lat * (($gps_vars[2] == "N") ? 1 : -1);
- $gps_lon = $gps_lon_deg + $gps_lon_min / 60.0;
+ $gps_lon = (float) $gps_lon_deg + $gps_lon_min / 60.0;
$gps_lon = $gps_lon * (($gps_vars[4] == "E") ? 1 : -1);
$gps_lat_dir = $gps_vars[2];
$gps_lon_dir = $gps_vars[4];
@@ -157,9 +157,9 @@ if ($allow_query) {
$gps_lat_min = substr($gps_vars[6], 2);
$gps_lon_deg = substr($gps_vars[8], 0, 3);
$gps_lon_min = substr($gps_vars[8], 3);
- $gps_lat = $gps_lat_deg + $gps_lat_min / 60.0;
+ $gps_lat = (float) $gps_lat_deg + $gps_lat_min / 60.0;
$gps_lat = $gps_lat * (($gps_vars[7] == "N") ? 1 : -1);
- $gps_lon = $gps_lon_deg + $gps_lon_min / 60.0;
+ $gps_lon = (float) $gps_lon_deg + $gps_lon_min / 60.0;
$gps_lon = $gps_lon * (($gps_vars[9] == "E") ? 1 : -1);
$gps_lat_dir = $gps_vars[7];
$gps_lon_dir = $gps_vars[9];
diff --git a/src/usr/local/www/widgets/widgets/ntp_status.widget.php b/src/usr/local/www/widgets/widgets/ntp_status.widget.php
index de9d208..6a40b83 100644
--- a/src/usr/local/www/widgets/widgets/ntp_status.widget.php
+++ b/src/usr/local/www/widgets/widgets/ntp_status.widget.php
@@ -71,9 +71,9 @@ if ($_REQUEST['updateme']) {
$gps_lat_min = substr($gps_vars[3], 2);
$gps_lon_deg = substr($gps_vars[5], 0, 3);
$gps_lon_min = substr($gps_vars[5], 3);
- $gps_lat = $gps_lat_deg + $gps_lat_min / 60.0;
+ $gps_lat = (float) $gps_lat_deg + $gps_lat_min / 60.0;
$gps_lat = $gps_lat * (($gps_vars[4] == "N") ? 1 : -1);
- $gps_lon = $gps_lon_deg + $gps_lon_min / 60.0;
+ $gps_lon = (float) $gps_lon_deg + $gps_lon_min / 60.0;
$gps_lon = $gps_lon * (($gps_vars[6] == "E") ? 1 : -1);
$gps_lat_dir = $gps_vars[4];
$gps_lon_dir = $gps_vars[6];
@@ -84,9 +84,9 @@ if ($_REQUEST['updateme']) {
$gps_lat_min = substr($gps_vars[2], 2);
$gps_lon_deg = substr($gps_vars[4], 0, 3);
$gps_lon_min = substr($gps_vars[4], 3);
- $gps_lat = $gps_lat_deg + $gps_lat_min / 60.0;
+ $gps_lat = (float) $gps_lat_deg + $gps_lat_min / 60.0;
$gps_lat = $gps_lat * (($gps_vars[3] == "N") ? 1 : -1);
- $gps_lon = $gps_lon_deg + $gps_lon_min / 60.0;
+ $gps_lon = (float) $gps_lon_deg + $gps_lon_min / 60.0;
$gps_lon = $gps_lon * (($gps_vars[5] == "E") ? 1 : -1);
$gps_alt = $gps_vars[9];
$gps_alt_unit = $gps_vars[10];
@@ -100,9 +100,9 @@ if ($_REQUEST['updateme']) {
$gps_lat_min = substr($gps_vars[1], 2);
$gps_lon_deg = substr($gps_vars[3], 0, 3);
$gps_lon_min = substr($gps_vars[3], 3);
- $gps_lat = $gps_lat_deg + $gps_lat_min / 60.0;
+ $gps_lat = (float) $gps_lat_deg + $gps_lat_min / 60.0;
$gps_lat = $gps_lat * (($gps_vars[2] == "N") ? 1 : -1);
- $gps_lon = $gps_lon_deg + $gps_lon_min / 60.0;
+ $gps_lon = (float) $gps_lon_deg + $gps_lon_min / 60.0;
$gps_lon = $gps_lon * (($gps_vars[4] == "E") ? 1 : -1);
$gps_lat_dir = $gps_vars[2];
$gps_lon_dir = $gps_vars[4];
@@ -113,9 +113,9 @@ if ($_REQUEST['updateme']) {
$gps_lat_min = substr($gps_vars[6], 2);
$gps_lon_deg = substr($gps_vars[8], 0, 3);
$gps_lon_min = substr($gps_vars[8], 3);
- $gps_lat = $gps_lat_deg + $gps_lat_min / 60.0;
+ $gps_lat = (float) $gps_lat_deg + $gps_lat_min / 60.0;
$gps_lat = $gps_lat * (($gps_vars[7] == "N") ? 1 : -1);
- $gps_lon = $gps_lon_deg + $gps_lon_min / 60.0;
+ $gps_lon = (float) $gps_lon_deg + $gps_lon_min / 60.0;
$gps_lon = $gps_lon * (($gps_vars[9] == "E") ? 1 : -1);
$gps_lat_dir = $gps_vars[7];
$gps_lon_dir = $gps_vars[9];
OpenPOWER on IntegriCloud