RangeNetworks / openbts

GSM+GPRS Radio Access Network Node
GNU Affero General Public License v3.0
879 stars 330 forks source link

Fix bug with command lengths over 127 #11

Open Will-W opened 9 years ago

Will-W commented 9 years ago

The wrong value is being compared for the length.

It was working before because len was a large number (above 4) so never failed the check.

Command line lengths in the range 128-255 have the high bit set in the least significant byte (which is the most significant byte before the ntohl byte reversal is done). During the comparison that first bit is interpreted as a sign bit, so len is interpreted as negative and the check incorrectly fails.