mirror of
https://github.com/merbanan/rtl_433.git
synced 2026-07-31 18:47:04 -04:00
Reject implausible state nibble in waveman (#3611)
Real captures (tests/waveman) show the state nibble is always exactly 0xe (ON) or 0x6 (OFF); the code previously treated any value other than 0xe as "OFF", silently accepting 14 of 16 possible nibble values as a false decode. Reject anything but those two observed values instead.
This commit is contained in:
@@ -62,6 +62,14 @@ static int waveman_callback(r_device *decoder, bitbuffer_t *bitbuffer)
|
||||
| ((b[i] & 0x01) ? 0x00 : 0x08);
|
||||
}
|
||||
|
||||
// Only 0xe (ON) and 0x6 (OFF) are valid states in real captures; any other
|
||||
// value was previously still accepted and reported as "OFF", silently
|
||||
// letting 14 of 16 possible nibble values through as a false decode.
|
||||
if (nb[2] != 0xe && nb[2] != 0x6) {
|
||||
decoder_logf(decoder, 2, __func__, "implausible state nibble: %x", nb[2]);
|
||||
return DECODE_FAIL_SANITY;
|
||||
}
|
||||
|
||||
id_str[0] = 'A' + nb[0];
|
||||
id_str[1] = '\0';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user