Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at dtd_parse.c:1545

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/dtd_parse.c)expand/collapse
Show more  
 1480  static int yy_get_next_buffer (void)
 1481  {
 1482          register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
 1483          register char *source = (yytext_ptr);
 1484          register int number_to_move, i;
 1485          int ret_val;
 1486   
 1487          if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
 1488                  YY_FATAL_ERROR(
 1489                  "fatal flex scanner internal error--end of buffer missed" );
 1490   
 1491          if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
 1492                  { /* Don't try to fill the buffer, so this is an EOF. */
 1493                  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
 1494                          {
 1495                          /* We matched a single character, the EOB, so 
 1496                           * treat this as a final EOF.
 1497                           */
 1498                          return EOB_ACT_END_OF_FILE;
 1499                          }
 1500   
 1501                  else 
 1502                          {
 1503                          /* We matched some text prior to the EOB, first 
 1504                           * process it.
 1505                           */
 1506                          return EOB_ACT_LAST_MATCH;
 1507                          }
 1508                  }
 1509   
 1510          /* Try to read more data. */
 1511   
 1512          /* First move last chars to start of buffer. */
 1513          number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
 1514   
 1515          for ( i = 0; i < number_to_move; ++i )
 1516                  *(dest++) = *(source++);
 1517   
 1518          if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
 1519                  /* don't do the read, it's not guaranteed to return an EOF,
 1520                   * just force an EOF
 1521                   */
 1522                  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
 1523   
 1524          else 
 1525                  {
 1526                          int num_to_read =
 1527                          YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 1528   
 1529                  while ( num_to_read <= 0 )
 1530                          { /* Not enough room in the buffer - grow it. */
 1531   
 1532                          /* just a shorter name for the current buffer */
 1533                          YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
 1534   
 1535                          int yy_c_buf_p_offset =
 1536                                  (int) ((yy_c_buf_p) - b->yy_ch_buf);
 1537   
 1538                          if ( b->yy_is_our_buffer )
 1539                                  {
 1540                                  int new_size = b->yy_buf_size * 2;
 1541   
 1542                                  if ( new_size <= 0 )
 1543                                          b->yy_buf_size += b->yy_buf_size / 8;
 1544                                  else 
 1545                                          b->yy_buf_size *= 2;
 1546   
 1547                                  b->yy_ch_buf = (char *)
 1548                                          /* Include room in for 2 EOB chars. */
 1549[+]                                         Dtd_Parse_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
expand/collapse

Dtd_Parse_realloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dtd_parse.c)expand/collapse
Show more  
 2278  void *Dtd_Parse_realloc  (void * ptr, yy_size_t  size )
 2279  {
 2280          /* The cast to (char *) in the following accommodates both 
 2281           * implementations that use char* generic pointers, and those
 2282           * that use void* generic pointers.  It works with the latter
 2283           * because both ANSI C and C++ allow castless assignment from
 2284           * any pointer type to void*, and deal with argument conversions 
 2285           * as though doing an assignment.
 2286           */
 2287          return (void *) realloc( (char *) ptr, size );
Show more  
Show more  




Change Warning 3082.30265 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: