Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at k12text.c:1524

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/wiretap/k12text.c)expand/collapse
Show more  
 1459  static int yy_get_next_buffer (void)
 1460  {
 1461          register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
 1462          register char *source = (yytext_ptr);
 1463          register int number_to_move, i;
 1464          int ret_val;
 1465   
 1466          if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
 1467                  YY_FATAL_ERROR(
 1468                  "fatal flex scanner internal error--end of buffer missed" );
 1469   
 1470          if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
 1471                  { /* Don't try to fill the buffer, so this is an EOF. */
 1472                  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
 1473                          {
 1474                          /* We matched a single character, the EOB, so 
 1475                           * treat this as a final EOF.
 1476                           */
 1477                          return EOB_ACT_END_OF_FILE;
 1478                          }
 1479   
 1480                  else 
 1481                          {
 1482                          /* We matched some text prior to the EOB, first 
 1483                           * process it.
 1484                           */
 1485                          return EOB_ACT_LAST_MATCH;
 1486                          }
 1487                  }
 1488   
 1489          /* Try to read more data. */
 1490   
 1491          /* First move last chars to start of buffer. */
 1492          number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
 1493   
 1494          for ( i = 0; i < number_to_move; ++i )
 1495                  *(dest++) = *(source++);
 1496   
 1497          if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
 1498                  /* don't do the read, it's not guaranteed to return an EOF,
 1499                   * just force an EOF
 1500                   */
 1501                  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
 1502   
 1503          else 
 1504                  {
 1505                          int num_to_read =
 1506                          YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 1507   
 1508                  while ( num_to_read <= 0 )
 1509                          { /* Not enough room in the buffer - grow it. */
 1510   
 1511                          /* just a shorter name for the current buffer */
 1512                          YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
 1513   
 1514                          int yy_c_buf_p_offset =
 1515                                  (int) ((yy_c_buf_p) - b->yy_ch_buf);
 1516   
 1517                          if ( b->yy_is_our_buffer )
 1518                                  {
 1519                                  int new_size = b->yy_buf_size * 2;
 1520   
 1521                                  if ( new_size <= 0 )
 1522                                          b->yy_buf_size += b->yy_buf_size / 8;
 1523                                  else 
 1524                                          b->yy_buf_size *= 2;
 1525   
 1526                                  b->yy_ch_buf = (char *)
 1527                                          /* Include room in for 2 EOB chars. */
 1528[+]                                         K12Text_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
expand/collapse

K12Text_realloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/k12text.c)expand/collapse
Show more  
 2257  void *K12Text_realloc  (void * ptr, yy_size_t  size )
 2258  {
 2259          /* The cast to (char *) in the following accommodates both 
 2260           * implementations that use char* generic pointers, and those
 2261           * that use void* generic pointers.  It works with the latter
 2262           * because both ANSI C and C++ allow castless assignment from
 2263           * any pointer type to void*, and deal with argument conversions 
 2264           * as though doing an assignment.
 2265           */
 2266          return (void *) realloc( (char *) ptr, size );
Show more  
Show more  




Change Warning 1078.30280 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: