Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at radius_dict.c:1933

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/radius_dict.c)expand/collapse
Show more  
 1868  static int yy_get_next_buffer (void)
 1869  {
 1870          register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
 1871          register char *source = (yytext_ptr);
 1872          register int number_to_move, i;
 1873          int ret_val;
 1874   
 1875          if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
 1876                  YY_FATAL_ERROR(
 1877                  "fatal flex scanner internal error--end of buffer missed" );
 1878   
 1879          if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
 1880                  { /* Don't try to fill the buffer, so this is an EOF. */
 1881                  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
 1882                          {
 1883                          /* We matched a single character, the EOB, so 
 1884                           * treat this as a final EOF.
 1885                           */
 1886                          return EOB_ACT_END_OF_FILE;
 1887                          }
 1888   
 1889                  else 
 1890                          {
 1891                          /* We matched some text prior to the EOB, first 
 1892                           * process it.
 1893                           */
 1894                          return EOB_ACT_LAST_MATCH;
 1895                          }
 1896                  }
 1897   
 1898          /* Try to read more data. */
 1899   
 1900          /* First move last chars to start of buffer. */
 1901          number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
 1902   
 1903          for ( i = 0; i < number_to_move; ++i )
 1904                  *(dest++) = *(source++);
 1905   
 1906          if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
 1907                  /* don't do the read, it's not guaranteed to return an EOF,
 1908                   * just force an EOF
 1909                   */
 1910                  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
 1911   
 1912          else 
 1913                  {
 1914                          int num_to_read =
 1915                          YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 1916   
 1917                  while ( num_to_read <= 0 )
 1918                          { /* Not enough room in the buffer - grow it. */
 1919   
 1920                          /* just a shorter name for the current buffer */
 1921                          YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
 1922   
 1923                          int yy_c_buf_p_offset =
 1924                                  (int) ((yy_c_buf_p) - b->yy_ch_buf);
 1925   
 1926                          if ( b->yy_is_our_buffer )
 1927                                  {
 1928                                  int new_size = b->yy_buf_size * 2;
 1929   
 1930                                  if ( new_size <= 0 )
 1931                                          b->yy_buf_size += b->yy_buf_size / 8;
 1932                                  else 
 1933                                          b->yy_buf_size *= 2;
 1934   
 1935                                  b->yy_ch_buf = (char *)
 1936                                          /* Include room in for 2 EOB chars. */
 1937[+]                                         Radiusrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
expand/collapse

Radiusrealloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/radius_dict.c)expand/collapse
Show more  
 2666  void *Radiusrealloc  (void * ptr, yy_size_t  size )
 2667  {
 2668          /* The cast to (char *) in the following accommodates both 
 2669           * implementations that use char* generic pointers, and those
 2670           * that use void* generic pointers.  It works with the latter
 2671           * because both ANSI C and C++ allow castless assignment from
 2672           * any pointer type to void*, and deal with argument conversions 
 2673           * as though doing an assignment.
 2674           */
 2675          return (void *) realloc( (char *) ptr, size );
Show more  
 1938                                  }
 1939                          else 
 1940                                  /* Can't grow it, we don't own it. */
 1941                                  b->yy_ch_buf = 0;
 1942   
 1943                          if ( ! b->yy_ch_buf )
 1944                                  YY_FATAL_ERROR(
 1945                                  "fatal error - scanner input buffer overflow" );
 1946   
 1947                          (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
 1948   
 1949                          num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
 1950                                                  number_to_move - 1;
Show more  




Change Warning 2912.30274 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: