Menu

#16 erroneous conversion from signed to unsigned int allows to circumvent MaxRadarRange

fgms-0.9
closed
None
5
2022-06-05
2022-05-23
No

In fg_server.cxx line 814/815 and 1398/1399 the erroneous conversion from signed to unsigned int allows the client to circumvent the MaxRadarRange limit:

        if ( tmp->High <= m_MaxRadarRange )
            NewPlayer.RadarRange = tmp->High;

If the client transmits a negative value for the requested radar range e.g. tmp->High = -1 then the if statement yields true and -1 is implicit converted and assigned to unsigned int (uint16_t) variable FG_Player::RadarRange as 65535, meaning all aircraft (independent of distance) are transmitted to the client.

Discussion

  • Oliver Schroeder

    • status: open --> pending
    • assigned_to: Oliver Schroeder
     
  • Oliver Schroeder

    RadarRange should not be negative, so a client should not be able to transmit a negative value. However, the conversion is false and I fixed it using only unsigned ints.
    It does not prevent a client from setting the radar range to 65535, though.

     
  • Oliver Schroeder

    • status: pending --> closed
     
  • Oliver Schroeder

    Fixed in 0.13.8 (upcoming release)

     

Log in to post a comment.