(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/toshiba.c) |
| |
| 235 | | | static gboolean toshiba_read(wtap *wth, int *err, gchar **err_info, |
| 236 | | | gint64 *data_offset) |
| 237 | | | { |
| 238 | | | gint64 offset; |
| 239 | | | guint8 *buf; |
| 240 | | | int pkt_len; |
| 241 | | | |
| 242 | | | |
| 243 | | | offset = toshiba_seek_next_packet(wth, err); |
| 244 | | | if (offset < 1) |
| 245 | | | return FALSE; |
| 246 | | | |
| 247 | | | |
| 248 | | | pkt_len = parse_toshiba_rec_hdr(wth, wth->fh, &wth->, |
| 249 | | | err, err_info); |
| 250 | | | if (pkt_len == -1) |
Redundant Condition
pkt_len == -1 always evaluates to true. This may be because: - There is a constant assignment to one or more of the variables involved.
- An earlier conditional statement has already ensured that pkt_len == -1 cannot be false.
- A crashing bug occurs on every path where pkt_len == -1 could have evaluated to false. Look for a preceding Null Pointer Dereference or Division By Zero warning.
|
|
| 251 | | | return FALSE; |
| 252 | | | |
| 253 | | | |
| 254 | | | buffer_assure_space(wth->frame_buffer, TOSHIBA_MAX_PACKET_LEN); |
| 255 | | | buf = buffer_start_ptr(wth->frame_buffer);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/buffer.h |
| |
46 | # define buffer_start_ptr(buffer) ((buffer)->data + (buffer)->start) |
| |
|
| 256 | | | |
| 257 | | | |
| 258 | | | if (!parse_toshiba_hex_dump(wth->fh, pkt_len, buf, err, err_info)) |
| 259 | | | return FALSE; |
| 260 | | | |
| 261 | | | wth->data_offset = offset; |
| 262 | | | *data_offset = offset; |
| 263 | | | return TRUE; |
| 264 | | | } |
| |