Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at radius_dict.c:2383

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

Radiusensure_buffer_stack

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/radius_dict.c)expand/collapse
Show more  
 2351  static void Radiusensure_buffer_stack (void)
 2352  {
 2353          int num_to_alloc;
 2354       
 2355          if (!(yy_buffer_stack)) {
 2356   
 2357                  /* First allocation is just for 2 elements, since we don't know if this 
 2358                   * scanner will even need a stack. We use 2 instead of 1 to avoid an 
 2359                   * immediate realloc on the next call.
 2360           */
 2361                  num_to_alloc = 1;
 2362                  (yy_buffer_stack) = (struct yy_buffer_state**)Radiusalloc
 2363                                                                  (num_to_alloc * sizeof(struct yy_buffer_state*)
 2364                                                                  );
 2365                  if ( ! (yy_buffer_stack) )
 2366                          YY_FATAL_ERROR( "out of dynamic memory in Radiusensure_buffer_stack()" );
 2367                                                                     
 2368                  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 2369                                   
 2370                  (yy_buffer_stack_max) = num_to_alloc;
 2371                  (yy_buffer_stack_top) = 0;
 2372                  return;
 2373          }
 2374   
 2375          if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 2376   
 2377                  /* Increase the buffer to prepare for a possible push. */
 2378                  int grow_size = 8 /* arbitrary grow size */;
 2379   
 2380                  num_to_alloc = (yy_buffer_stack_max) + grow_size;
 2381                  (yy_buffer_stack) = (struct yy_buffer_state**)Radiusrealloc
 2382                                                                  ((yy_buffer_stack),
 2383                                                                  num_to_alloc * sizeof(struct yy_buffer_state*)
 2384[+]                                                                 );
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  
Show more  




Change Warning 2908.30101 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: