From 6822a1346a4c72b271fa76bc5a18fedfe3bda370 Mon Sep 17 00:00:00 2001 From: narspt Date: Wed, 5 Jan 2022 21:38:51 +0000 Subject: [PATCH] avoid invalid lat/lon/height values increasing RPTC pkt len --- DMRGateway.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/DMRGateway.cpp b/DMRGateway.cpp index e66d7e4..a826f6a 100644 --- a/DMRGateway.cpp +++ b/DMRGateway.cpp @@ -2422,12 +2422,18 @@ unsigned int CDMRGateway::getConfig(const std::string& name, unsigned char* buff assert(buffer != NULL); float lat = m_conf.getInfoLatitude(); + if ((lat > 90) || (lat < -90)) + lat = 0; float lon = m_conf.getInfoLongitude(); + if ((lon > 180) || (lon < -180)) + lon = 0; int height = m_conf.getInfoHeight(); if (height > 999) height = 999; + else if (height < 0) + height = 0; std::string location = m_conf.getInfoLocation(); std::string description = m_conf.getInfoDescription();