Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at mate_parser.c:2071

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

Mateensure_buffer_stack

(/home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/mate/mate_parser.c)expand/collapse
Show more  
 2039  static void Mateensure_buffer_stack (void)
 2040  {
 2041          int num_to_alloc;
 2042       
 2043          if (!(yy_buffer_stack)) {
 2044   
 2045                  /* First allocation is just for 2 elements, since we don't know if this 
 2046                   * scanner will even need a stack. We use 2 instead of 1 to avoid an 
 2047                   * immediate realloc on the next call.
 2048           */
 2049                  num_to_alloc = 1;
 2050                  (yy_buffer_stack) = (struct yy_buffer_state**)Matealloc
 2051                                                                  (num_to_alloc * sizeof(struct yy_buffer_state*)
 2052                                                                  );
 2053                  if ( ! (yy_buffer_stack) )
 2054                          YY_FATAL_ERROR( "out of dynamic memory in Mateensure_buffer_stack()" );
 2055                                                                     
 2056                  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 2057                                   
 2058                  (yy_buffer_stack_max) = num_to_alloc;
 2059                  (yy_buffer_stack_top) = 0;
 2060                  return;
 2061          }
 2062   
 2063          if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 2064   
 2065                  /* Increase the buffer to prepare for a possible push. */
 2066                  int grow_size = 8 /* arbitrary grow size */;
 2067   
 2068                  num_to_alloc = (yy_buffer_stack_max) + grow_size;
 2069                  (yy_buffer_stack) = (struct yy_buffer_state**)Materealloc
 2070                                                                  ((yy_buffer_stack),
 2071                                                                  num_to_alloc * sizeof(struct yy_buffer_state*)
 2072[+]                                                                 );
expand/collapse

Materealloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/mate/mate_parser.c)expand/collapse
Show more  
 2354  void *Materealloc  (void * ptr, yy_size_t  size )
 2355  {
 2356          /* The cast to (char *) in the following accommodates both 
 2357           * implementations that use char* generic pointers, and those
 2358           * that use void* generic pointers.  It works with the latter
 2359           * because both ANSI C and C++ allow castless assignment from
 2360           * any pointer type to void*, and deal with argument conversions 
 2361           * as though doing an assignment.
 2362           */
 2363          return (void *) realloc( (char *) ptr, size );
Show more  
Show more  




Change Warning 3726.30089 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: