(/home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/mate/mate_parser.c) |
| |
| 2088 | | | YY_BUFFER_STATE Mate_scan_buffer (char * base, yy_size_t size ) |
| 2089 | | | { |
| 2090 | | | YY_BUFFER_STATE b; |
| 2091 | | | |
| 2092 | | | if ( size < 2 || |
| 2093 | | | base[size-2] != YY_END_OF_BUFFER_CHAR || |
| 2094 | | | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
Redundant Condition
base[size - 1] != 0 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 base[size - 1] != 0 cannot be false.
- A crashing bug occurs on every path where base[size - 1] != 0 could have evaluated to false. Look for a preceding Null Pointer Dereference or Division By Zero warning.
|
|
| 2095 | | | |
| 2096 | | | return 0; |
| 2097 | | | |
| 2098 | | | b = (YY_BUFFER_STATE) Matealloc(sizeof( struct yy_buffer_state ) ); |
| 2099 | | | if ( ! b ) |
| 2100 | | | YY_FATAL_ERROR( "out of dynamic memory in Mate_scan_buffer()" ); |
| 2101 | | | |
| 2102 | | | b->yy_buf_size = size - 2; |
| 2103 | | | b->yy_buf_pos = b->yy_ch_buf = base; |
| 2104 | | | b->yy_is_our_buffer = 0; |
| 2105 | | | b->yy_input_file = 0; |
| 2106 | | | b->yy_n_chars = b->yy_buf_size; |
| 2107 | | | b->yy_is_interactive = 0; |
| 2108 | | | b->yy_at_bol = 1; |
| 2109 | | | b->yy_fill_buffer = 0; |
| 2110 | | | b->yy_buffer_status = YY_BUFFER_NEW; |
| 2111 | | | |
| 2112 | | | Mate_switch_to_buffer(b ); |
| 2113 | | | |
| 2114 | | | return b; |
| 2115 | | | } |
| |