(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/diam_dict.c) |
| |
| 2641 | | | YY_BUFFER_STATE DiamDict_scan_buffer (char * base, yy_size_t size ) |
| 2642 | | | { |
| 2643 | | | YY_BUFFER_STATE b; |
| 2644 | | | |
| 2645 | | | if ( size < 2 || |
| 2646 | | | base[size-2] != YY_END_OF_BUFFER_CHAR || |
| 2647 | | | 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.
|
|
| 2648 | | | |
| 2649 | | | return 0; |
| 2650 | | | |
| 2651 | | | b = (YY_BUFFER_STATE) DiamDictalloc(sizeof( struct yy_buffer_state ) ); |
| 2652 | | | if ( ! b ) |
| 2653 | | | YY_FATAL_ERROR( "out of dynamic memory in DiamDict_scan_buffer()" ); |
| 2654 | | | |
| 2655 | | | b->yy_buf_size = size - 2; |
| 2656 | | | b->yy_buf_pos = b->yy_ch_buf = base; |
| 2657 | | | b->yy_is_our_buffer = 0; |
| 2658 | | | b->yy_input_file = 0; |
| 2659 | | | b->yy_n_chars = b->yy_buf_size; |
| 2660 | | | b->yy_is_interactive = 0; |
| 2661 | | | b->yy_at_bol = 1; |
| 2662 | | | b->yy_fill_buffer = 0; |
| 2663 | | | b->yy_buffer_status = YY_BUFFER_NEW; |
| 2664 | | | |
| 2665 | | | DiamDict_switch_to_buffer(b ); |
| 2666 | | | |
| 2667 | | | return b; |
| 2668 | | | } |
| |