Another bug found by valgrind.

This commit is contained in:
Oliver Jowett 2015-01-12 01:19:25 +00:00
parent 272efcbdc4
commit fa4c85eba5

View file

@ -1753,9 +1753,11 @@ void detectModeS(uint16_t *m, uint32_t mlen) {
} }
// Ensure msglen is consistent with the DF type // Ensure msglen is consistent with the DF type
i = modesMessageLenByType(msg[0] >> 3); if (msglen > 0) {
if (msglen > i) {msglen = i;} i = modesMessageLenByType(msg[0] >> 3);
else if (msglen < i) {msglen = 0;} if (msglen > i) {msglen = i;}
else if (msglen < i) {msglen = 0;}
}
// //
// If we guessed at any of the bits in the DF type field, then look to see if our guess was sensible. // If we guessed at any of the bits in the DF type field, then look to see if our guess was sensible.
@ -2256,9 +2258,11 @@ void detectModeS_oversample(uint16_t *m, uint32_t mlen) {
} }
// Ensure msglen is consistent with the DF type // Ensure msglen is consistent with the DF type
i = modesMessageLenByType(msg[0] >> 3); if (msglen > 0) {
if (msglen > i) {msglen = i;} i = modesMessageLenByType(msg[0] >> 3);
else if (msglen < i) {msglen = 0;} if (msglen > i) {msglen = i;}
else if (msglen < i) {msglen = 0;}
}
// //
// If we guessed at any of the bits in the DF type field, then look to see if our guess was sensible. // If we guessed at any of the bits in the DF type field, then look to see if our guess was sensible.