Sanity checks for upper/lower bounds on the lat/lon coordinates. Fixes several segfaults.
This commit is contained in:
parent
221080e281
commit
75ba542c38
@ -51,6 +51,11 @@ public:
|
||||
|
||||
int lat = static_cast<int>(100000.*atof(parameters[0].c_str()));
|
||||
int lon = static_cast<int>(100000.*atof(parameters[1].c_str()));
|
||||
|
||||
if(lat>90*100000 || lat <-90*100000 || lon>180*100000 || lon <-180*100000) {
|
||||
reply = http::Reply::stockReply(http::Reply::badRequest);
|
||||
return;
|
||||
}
|
||||
//query to helpdesk
|
||||
_Coordinate result;
|
||||
nodeHelpDesk->findNearestNodeCoordForLatLon(_Coordinate(lat, lon), result);
|
||||
|
@ -81,6 +81,16 @@ public:
|
||||
int lat2 = static_cast<int>(100000.*atof(parameters[2].c_str()));
|
||||
int lon2 = static_cast<int>(100000.*atof(parameters[3].c_str()));
|
||||
|
||||
if(lat1>90*100000 || lat1 <-90*100000 || lon1>180*100000 || lon1 <-180*100000) {
|
||||
reply = http::Reply::stockReply(http::Reply::badRequest);
|
||||
return;
|
||||
}
|
||||
|
||||
if(lat2>90*100000 || lat2 <-90*100000 || lon2>180*100000 || lon2 <-180*100000) {
|
||||
reply = http::Reply::stockReply(http::Reply::badRequest);
|
||||
return;
|
||||
}
|
||||
|
||||
_Coordinate startCoord(lat1, lon1);
|
||||
_Coordinate targetCoord(lat2, lon2);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user