forked from osmocom/wireshark
Move a test.
If we're not going to subtract 4 from actual_octets, there's no reason to treat actual_octets < 4 as an error. This makes the "subtract 4 octets of crap" code similar in all cases, hopefully further reducing the opacity of the code. Change-Id: I41cda101b321422ce5fd4474fb6903bfe471cb63 Reviewed-on: https://code.wireshark.org/review/23534 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
9e905abe54
commit
f3cf2ffd3a
|
@ -2112,29 +2112,32 @@ static gboolean vwr_read_s3_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr,
|
|||
* lsb nibble is set to 1 always as this function is applicable for only FPGA version >= 48
|
||||
*/
|
||||
if (log_mode == 3) {
|
||||
/*
|
||||
* The MSDU length includes the FCS.
|
||||
*
|
||||
* The packet data does *not* include the FCS - it's just 4 bytes
|
||||
* of junk - so we have to remove it.
|
||||
*
|
||||
* We'll be stripping off that junk, so make sure we have at
|
||||
* least 4 octets worth of packet data.
|
||||
*
|
||||
* XXX - is the FCS actually present here, as it appears to be
|
||||
* if log_mode isn't 3?
|
||||
*
|
||||
* There seems to be a special case of a length of 0.
|
||||
*/
|
||||
if (actual_octets < 4) {
|
||||
if (actual_octets != 0) {
|
||||
*err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)",
|
||||
actual_octets);
|
||||
*err = WTAP_ERR_BAD_FILE;
|
||||
return FALSE;
|
||||
if (frame_size >= (int) msdu_length) {
|
||||
/*
|
||||
* The MSDU length includes the FCS.
|
||||
*
|
||||
* The packet data does *not* include the FCS - it's just 4
|
||||
* bytes of junk - so we have to remove it.
|
||||
*
|
||||
* We'll be stripping off that junk, so make sure we have at
|
||||
* least 4 octets worth of packet data.
|
||||
*
|
||||
* XXX - is the FCS actually present here, as it appears to be
|
||||
* if log_mode isn't 3?
|
||||
*
|
||||
* There seems to be a special case of a length of 0.
|
||||
*/
|
||||
if (actual_octets < 4) {
|
||||
if (actual_octets != 0) {
|
||||
*err_info = g_strdup_printf("vwr: Invalid data length %u (too short to include 4 bytes of FCS)",
|
||||
actual_octets);
|
||||
*err = WTAP_ERR_BAD_FILE;
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
actual_octets -= 4;
|
||||
}
|
||||
} else if (frame_size >= (int) msdu_length)
|
||||
actual_octets -= 4;
|
||||
}
|
||||
ver_fpga = 0x11;
|
||||
} else {
|
||||
ver_fpga = 0x01;
|
||||
|
|
Loading…
Reference in New Issue