Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at uat_load.c:1291

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/uat_load.c)expand/collapse
Show more  
 1226  static int yy_get_next_buffer (void)
 1227  {
 1228          register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
 1229          register char *source = (yytext_ptr);
 1230          register int number_to_move, i;
 1231          int ret_val;
 1232   
 1233          if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
 1234                  YY_FATAL_ERROR(
 1235                  "fatal flex scanner internal error--end of buffer missed" );
 1236   
 1237          if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
 1238                  { /* Don't try to fill the buffer, so this is an EOF. */
 1239                  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
 1240                          {
 1241                          /* We matched a single character, the EOB, so 
 1242                           * treat this as a final EOF.
 1243                           */
 1244                          return EOB_ACT_END_OF_FILE;
 1245                          }
 1246   
 1247                  else 
 1248                          {
 1249                          /* We matched some text prior to the EOB, first 
 1250                           * process it.
 1251                           */
 1252                          return EOB_ACT_LAST_MATCH;
 1253                          }
 1254                  }
 1255   
 1256          /* Try to read more data. */
 1257   
 1258          /* First move last chars to start of buffer. */
 1259          number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
 1260   
 1261          for ( i = 0; i < number_to_move; ++i )
 1262                  *(dest++) = *(source++);
 1263   
 1264          if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
 1265                  /* don't do the read, it's not guaranteed to return an EOF,
 1266                   * just force an EOF
 1267                   */
 1268                  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
 1269   
 1270          else 
 1271                  {
 1272                          int num_to_read =
 1273                          YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 1274   
 1275                  while ( num_to_read <= 0 )
 1276                          { /* Not enough room in the buffer - grow it. */
 1277   
 1278                          /* just a shorter name for the current buffer */
 1279                          YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
 1280   
 1281                          int yy_c_buf_p_offset =
 1282                                  (int) ((yy_c_buf_p) - b->yy_ch_buf);
 1283   
 1284                          if ( b->yy_is_our_buffer )
 1285                                  {
 1286                                  int new_size = b->yy_buf_size * 2;
 1287   
 1288                                  if ( new_size <= 0 )
 1289                                          b->yy_buf_size += b->yy_buf_size / 8;
 1290                                  else 
 1291                                          b->yy_buf_size *= 2;
 1292   
 1293                                  b->yy_ch_buf = (char *)
 1294                                          /* Include room in for 2 EOB chars. */
 1295[+]                                         uat_load_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
expand/collapse

uat_load_realloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/uat_load.c)expand/collapse
Show more  
 2024  void *uat_load_realloc  (void * ptr, yy_size_t  size )
 2025  {
 2026          /* The cast to (char *) in the following accommodates both 
 2027           * implementations that use char* generic pointers, and those
 2028           * that use void* generic pointers.  It works with the latter
 2029           * because both ANSI C and C++ allow castless assignment from
 2030           * any pointer type to void*, and deal with argument conversions 
 2031           * as though doing an assignment.
 2032           */
 2033          return (void *) realloc( (char *) ptr, size );
Show more  
Show more  




Change Warning 2652.30258 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: