Text   |  XML   |  ReML   |   Visible Warnings:

Integer Overflow of Allocation Size  at wimaxasncp_dict.c:2389

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

WimaxasncpDictensure_buffer_stack

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

WimaxasncpDictrealloc

(/home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimaxasncp/wimaxasncp_dict.c)expand/collapse
Show more  
 2717  void *WimaxasncpDictrealloc  (void * ptr, yy_size_t  size )
 2718  {
 2719          /* The cast to (char *) in the following accommodates both 
 2720           * implementations that use char* generic pointers, and those
 2721           * that use void* generic pointers.  It works with the latter
 2722           * because both ANSI C and C++ allow castless assignment from
 2723           * any pointer type to void*, and deal with argument conversions 
 2724           * as though doing an assignment.
 2725           */
 2726          return (void *) realloc( (char *) ptr, size );
Show more  
Show more  




Change Warning 3921.30097 : Integer Overflow of Allocation Size

Priority:
State:
Finding:
Owner:
Note: