Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at host.c:573

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2470.2498
Procedure: ht_insert
Trace: View
Modified: Wed Sep 2 12:39:43 2009   show details
 
Priority: None
State: None
Finding: None
Owner: None
  edit properties

Legend [ X ]
Warning Location
Contributes
Parse Error
Other Warning
Two or More Loop Iterations
On Execution Path
Comment
Macro
Preprocessor
Include
Keyword
Preprocessed Away

Source  |  Language: C Hide Legend     
ProblemLineSource
   /u1/paul/SATE/2010/c/pvm/pvm3/src/host.c
   Enter ht_insert
 507 ht_insert(htp, hp) 
 508         struct htab *htp;
 509         struct hostd *hp;
 510 {
 511         int hh;
 512         int i;
 513         unsigned long mask = 0, tmpmask;
 514  
 515         int *dsigs;
 516         int ndsigs;
 517         int found;
 518         int d;
 519  
 520         hh = (hp->hd_hostpart & tidhmask) >> (ffs(tidhmask) - 1);
 521  
 522         /* extend ht_hosts[] if no room */ 
 523  
 524         if (hh > htp->ht_last) {
 525                 int n = htp->ht_last;
 526  
 527                 htp->ht_last = (hh * 3) / 2;
 528                 htp->ht_hosts = TREALLOC(htp->ht_hosts, htp->ht_last + 1, struct hostd*);
 529                 while (++n <= htp->ht_last)
 530                         htp->ht_hosts[n] = 0;   /* Null Pointer Dereference (ID: 2570.2602) */  /* 6 more... */
 531         }
 532  
 533         /* if already have an entry, take this as an update XXX kind of a hack */ 
 534  
 535         if (htp->ht_hosts[hh]) {        /* already have an entry */ 
 536  
 537                 struct hostd *hp2 = htp->ht_hosts[hh];
 538  
 539                 if (hp->hd_name) {
 540                         if (hp2->hd_name)
 541                                 PVM_FREE(hp2->hd_name);
 542                         hp2->hd_name = STRALLOC(hp->hd_name);   /* Null Pointer Dereference (ID: 2474.2502) */
 543                 }
 544                 if (hp->hd_arch) {
 545                         if (hp2->hd_arch)
 546                                 PVM_FREE(hp2->hd_arch);
 547                         hp2->hd_arch = STRALLOC(hp->hd_arch);   /* Null Pointer Dereference (ID: 2473.2501) */
 548                 }
 549                 hp2->hd_dsig = hp->hd_dsig;
 550                 hp2->hd_mtu = hp->hd_mtu;
 551                 hp2->hd_sad = hp->hd_sad;
 552                 hp2->hd_speed = hp->hd_speed;
 553  
 554         } else {                                        /* add new entry */ 
 555  
 556                 htp->ht_hosts[hh] = hp;
 557                 if (hh)
 558                         htp->ht_cnt++;
 559                 hp->hd_ref++;
 560         }
 561  
 562         /* update number of arches */ 
 563  
true564         dsigs = TALLOC( htp->ht_cnt, int, "dsigs");
 565         ndsigs = 0;
 566  
 567         htp->ht_narch = 0;
 568         for (hh = htp->ht_last; hh > 0; hh--) {
 569                 hp = htp->ht_hosts[hh];
 570                 if (hp && hp->hd_arch) {
 571                         d = htp->ht_hosts[hh]->hd_dsig;
 572                         for ( i=0, found=0 ; i < ndsigs && !found ; i++ ) {
dsigs <= 4095573                                 if ( dsigs[i] == d )     /* Null Pointer Dereference */
 574                                         found++;
 575                         }
 576                         if ( !found ) {
 577                                 dsigs[ ndsigs++ ] = d;   /* Null Pointer Dereference (ID: 2471.2499) */
 578                                 htp->ht_narch++;
Preconditions
&$unknown_91040 = 0
&$unknown_91041 >= ((char*)$param_1)[4] + 1
&$unknown_91041 >= 2
&$unknown_91042 = 0
&$unknown_91043 = 1
&$unknown_91044 >= 1
((char*)$param_1)[8] >= 0
((char*)&((char*)((char*)*$param_1)[32])[8])[16] != 0
Postconditions
((char*)$unknown_91039)[16]' is freed
((char*)$unknown_91039)[8]' is freed
strlen(&$unknown_91039)' = strlen($param_2)
((char*)&$unknown_91039)[16]' = &$heap_3043
((char*)&$unknown_91039)[168]' = ((char*)$param_2)[168]
((char*)&$unknown_91039)[76]' = ((char*)$param_2)[76]
((char*)&$unknown_91039)[8]' = &$heap_3042
((char*)&$unknown_91039)[84]' = ((char*)$param_2)[84]
((char*)&$unknown_91039)[88]' = ((char*)$param_2)[88]
((char*)&$unknown_91039)[90]' = ((char*)$param_2)[90]
((char*)&$unknown_91039)[92]' = ((char*)$param_2)[92]
((char*)&$unknown_91039)[96]' = ((char*)$param_2)[96]
d' = ((char*)&((char*)((char*)*$param_1)[32])[8])[76]
dsigs' = &$unknown_91042
found' = 0
$heap_3042' = ((char*)*$param_2)[8]
bytes_after(&$heap_3042)' = strlen(((char*)$param_2)[8]) + 1
$heap_3042' is allocated by malloc
$heap_3042' is allocated
bytes_before(&$heap_3042)' = 0
strlen(&$heap_3042)' = strlen(((char*)$param_2)[8])
$heap_3043' = ((char*)*$param_2)[16]
bytes_after(&$heap_3043)' = strlen(((char*)$param_2)[16]) + 1
$heap_3043' is allocated by malloc
$heap_3043' is allocated
bytes_before(&$heap_3043)' = 0
strlen(&$heap_3043)' = strlen(((char*)$param_2)[16])
hh' = &$unknown_91043
hp' = ((char*)&((char*)*$param_1)[32])[8]
hp2' = &$unknown_91039
htp' = $param_1
i' = 0
mask' = 0
n' = &$unknown_91041 + 1
ndsigs' = &$unknown_91044




Change Warning 2470.2498 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: