Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at diam_dict.c:2137

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

yy_get_next_buffer

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/diam_dict.c)expand/collapse
Show more  
 2072  static int yy_get_next_buffer (void)
 2073  {
 2074          register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
 2075          register char *source = (yytext_ptr);
 2076          register int number_to_move, i;
 2077          int ret_val;
 2078   
 2079          if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
 2080                  YY_FATAL_ERROR(
 2081                  "fatal flex scanner internal error--end of buffer missed" );
 2082   
 2083          if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
 2084                  { /* Don't try to fill the buffer, so this is an EOF. */
 2085                  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
 2086                          {
 2087                          /* We matched a single character, the EOB, so 
 2088                           * treat this as a final EOF.
 2089                           */
 2090                          return EOB_ACT_END_OF_FILE;
 2091                          }
 2092   
 2093                  else 
 2094                          {
 2095                          /* We matched some text prior to the EOB, first 
 2096                           * process it.
 2097                           */
 2098                          return EOB_ACT_LAST_MATCH;
 2099                          }
 2100                  }
 2101   
 2102          /* Try to read more data. */
 2103   
 2104          /* First move last chars to start of buffer. */
 2105          number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
 2106   
 2107          for ( i = 0; i < number_to_move; ++i )
 2108                  *(dest++) = *(source++);
 2109   
 2110          if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
 2111                  /* don't do the read, it's not guaranteed to return an EOF,
 2112                   * just force an EOF
 2113                   */
 2114                  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
 2115   
 2116          else 
 2117                  {
 2118                          int num_to_read =
 2119                          YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 2120   
 2121                  while ( num_to_read <= 0 )
 2122                          { /* Not enough room in the buffer - grow it. */
 2123   
 2124                          /* just a shorter name for the current buffer */
 2125                          YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
 2126   
 2127                          int yy_c_buf_p_offset =
 2128                                  (int) ((yy_c_buf_p) - b->yy_ch_buf);
 2129   
 2130                          if ( b->yy_is_our_buffer )
 2131                                  {
 2132                                  int new_size = b->yy_buf_size * 2;
 2133   
 2134                                  if ( new_size <= 0 )
 2135                                          b->yy_buf_size += b->yy_buf_size / 8;
 2136                                  else 
 2137                                          b->yy_buf_size *= 2;
 2138   
 2139                                  b->yy_ch_buf = (char *)
 2140                                          /* Include room in for 2 EOB chars. */
 2141[+]                                         DiamDictrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
expand/collapse

DiamDictrealloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/diam_dict.c)expand/collapse
Show more  
 2952  void *DiamDictrealloc  (void * ptr, yy_size_t  size )
 2953  {
 2954          /* The cast to (char *) in the following accommodates both 
 2955           * implementations that use char* generic pointers, and those
 2956           * that use void* generic pointers.  It works with the latter
 2957           * because both ANSI C and C++ allow castless assignment from
 2958           * any pointer type to void*, and deal with argument conversions 
 2959           * as though doing an assignment.
 2960           */
 2961          return (void *) realloc( (char *) ptr, size );
Show more  
Show more  




Change Warning 2295.30264 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: