Text  |   XML   |   Visible Warnings:

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

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2669.2714
Procedure: ht_insert
Trace: View
Modified: Wed Sep 2 12:42:49 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/pvmd.c
   Enter slave_config
 5449 slave_config(hn, argc, argv) 
 5450         char *hn;
 5451         int argc;
 5452         char **argv;
 5453 {
 5454         int lh;                 /* local host index */ 
 5455         int mh;                 /* master host index */ 
 5456         struct hostd *hp;
 5457         int i, j;
 5458         int ac;
 5459         int ms = 0;             /* manual (humanoid) startup */ 
 5460 #ifndef WIN32 
 5461         int dof = 1;            /* fork, exit parent (default) */ 
 5462 #else 
 5463         int dof = 0; 
 5464 #endif 
 5465         int bad = 0;
 5466         char *p;
 5467         char *s;
 5468  
 5469         for (i = j = ac = 1; i < argc; i++) {
 5470                 if (argv[i][0] == '-') {
 5471                         switch (argv[i][1]) {
 5472  
 5473                         case 'S': 
 5474                                 ms = 1;
 5475                                 break;
 5476  
 5477                         case 'f': 
 5478                                 dof = 0;
 5479                                 break;
 5480  
 5481                         default: 
 5482                                 pvmlogprintf("slave_config() unknown switch: %s\n", argv[i]);
 5483                                 bad++;
 5484                         }
 5485  
 5486                 } else {
 5487                         argv[j++] = argv[i];
 5488                         ac++;
 5489                 }
 5490         }
 5491         argc = ac;
 5492  
 5493         if (bad || argc != 6) {
 5494                 pvmlogerror("slave_config: bad args\n");
 5495                 pvmbailout(0);
 5496         }
 5497  
 5498         mh = atoi(argv[1]);
 5499         lh = atoi(argv[4]);
true5500         hosts = ht_new(1);
 5501         hosts->ht_serial = 1;
 5502         hosts->ht_master = mh;
 5503         hosts->ht_cons = mh;
 5504         hosts->ht_local = lh;
 5505  
 5506         hp = hd_new(mh);
 5507         hp->hd_name = STRALLOC("?");   /* Null Pointer Dereference (ID: 2673.2721) */
 5508         hex_inadport(argv[2], &hp->hd_sad);
 5509         hp->hd_mtu = atoi(argv[3]);
 5510         ht_insert(hosts, hp);
 5511         hd_unref(hp);
 5512  
 5513         hp = hd_new(0);
 5514         hp->hd_name = STRALLOC("pvmd'");   /* Null Pointer Dereference (ID: 2672.2720) */
 5515         hp->hd_arch = STRALLOC(myarchname);   /* Null Pointer Dereference (ID: 2670.2718) */
 5516         hp->hd_mtu = pvmudpmtu;
 5517         hp->hd_dsig = pvmmydsig;
 5518         hex_inadport(argv[5], &hp->hd_sad);
 5519         ht_insert(hosts, hp);
 5520         hd_unref(hp);
 5521  
 5522         hp = hd_new(lh);
 5523         hp->hd_name = STRALLOC(hn);   /* Null Pointer Dereference (ID: 2671.2717) */
 5524         hp->hd_arch = STRALLOC(myarchname);   /* Null Pointer Dereference (ID: 2670.2715) */
 5525         hp->hd_mtu = pvmudpmtu;
 5526         hp->hd_dsig = pvmmydsig;
 5527         hex_inadport(argv[5], &hp->hd_sad);
hosts->ht_last < 5115528         ht_insert(hosts, hp);
     /u1/paul/SATE/2010/c/pvm/pvm3/src/host.c
     Enter slave_config / ht_insert
((char*)$param_1)[4] < 511507   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) {
htp->ht_last < 511525                   int n = htp->ht_last;
 526    
 527                   htp->ht_last = (hh * 3) / 2;
n < 511528                   htp->ht_hosts = TREALLOC(htp->ht_hosts, htp->ht_last + 1, struct hostd*);
 529                   while (++n <= htp->ht_last)
htp->ht_hosts <= 4095530                           htp->ht_hosts[n] = 0;     /* Null Pointer Dereference */  /* 6 more... */
     Exit slave_config / ht_insert
Preconditions
$param_2 >= 3
&$unknown_807469 >= 2
&$unknown_807470 >= 2
((char*)&$heap_77381)[8] >= 0
Postconditions
ac' = 6
argc' = 6
argv' = $param_3
bad' = 0
$heap_77381' = 1
bytes_after(&$heap_77381)' = 40
$heap_77381' is allocated by malloc
$heap_77381' is allocated
bytes_before(&$heap_77381)' = 0
strlen(&$heap_77381)' = 0
((char*)&$heap_77381)[16]' = $input_12
((char*)&$heap_77381)[20]' = $input_21244
((char*)&$heap_77381)[32]' = 0
((char*)&$heap_77381)[4]' = &$unknown_807470
((char*)&$heap_77381)[12]' = $input_12
$heap_77382' = 0
bytes_after(&$heap_77382)' = 16
$heap_77382' is allocated by malloc
$heap_77382' is allocated
bytes_before(&$heap_77382)' = 0
strlen(&$heap_77382)' = 0
$heap_77383' = 1
bytes_after(&$heap_77383)' = 200
$heap_77383' is allocated by malloc
bytes_before(&$heap_77383)' = 0
strlen(&$heap_77383)' = 0
((char*)&$heap_77383)[136]' = &$heap_77386
((char*)&$heap_77383)[152]' = 1
((char*)&$heap_77383)[168]' = 1000
((char*)&$heap_77383)[176]' = 0
((char*)&$heap_77383)[8]' = &$heap_77387
((char*)&$heap_77383)[84]' = $input_21252
((char*)&$heap_77383)[88]' = 2
((char*)&$heap_77383)[104]' = 1
((char*)&$heap_77383)[108]' = 1
((char*)&$heap_77383)[112]' = &$heap_77384
((char*)&$heap_77383)[120]' = &$heap_77385
bytes_after(&$heap_77384)' = 184
$heap_77384' is allocated by malloc
$heap_77384' is allocated
bytes_before(&$heap_77384)' = 0
((char*)&$heap_77384)[16]' = 0
((char*)&$heap_77384)[176]' = 0
((char*)&$heap_77384)[24]' = 0
((char*)&$heap_77384)[32]' = 0
((char*)&$heap_77384)[40]' = 0
bytes_after(&$heap_77385)' = 184
$heap_77385' is allocated by malloc
$heap_77385' is allocated
bytes_before(&$heap_77385)' = 0
((char*)&$heap_77385)[16]' = 0
((char*)&$heap_77385)[176]' = 0
((char*)&$heap_77385)[24]' = 0
((char*)&$heap_77385)[32]' = 0
((char*)&$heap_77385)[40]' = 0
$heap_77386' = &$heap_77386
bytes_after(&$heap_77386)' = 184
$heap_77386' is allocated by malloc
$heap_77386' is allocated
bytes_before(&$heap_77386)' = 0
((char*)&$heap_77386)[16]' = 0
((char*)&$heap_77386)[176]' = 0
((char*)&$heap_77386)[24]' = 0
((char*)&$heap_77386)[32]' = 0
((char*)&$heap_77386)[40]' = 0
((char*)&$heap_77386)[8]' = &$heap_77386
$heap_77387' = 63
bytes_after(&$heap_77387)' = 2
$heap_77387' is allocated by malloc
$heap_77387' is allocated
bytes_before(&$heap_77387)' = 0
strlen(&$heap_77387)' = 1
$heap_77388' = 1
bytes_after(&$heap_77388)' = 200
$heap_77388' is allocated by malloc
bytes_before(&$heap_77388)' = 0
strlen(&$heap_77388)' = 0
((char*)&$heap_77388)[136]' = &$heap_77389
((char*)&$heap_77388)[152]' = 1
((char*)&$heap_77388)[16]' = &$heap_77393
((char*)&$heap_77388)[168]' = 1000
((char*)&$heap_77388)[176]' = 0
((char*)&$heap_77388)[76]' = pvmmydsig
((char*)&$heap_77388)[8]' = &$heap_77392
((char*)&$heap_77388)[84]' = pvmudpmtu
((char*)&$heap_77388)[88]' = 2
((char*)&$heap_77388)[104]' = 1
((char*)&$heap_77388)[108]' = 1
((char*)&$heap_77388)[112]' = &$heap_77391
((char*)&$heap_77388)[120]' = &$heap_77390
$heap_77389' = &$heap_77389
bytes_after(&$heap_77389)' = 184
$heap_77389' is allocated by malloc
$heap_77389' is allocated
bytes_before(&$heap_77389)' = 0
((char*)&$heap_77389)[16]' = 0
((char*)&$heap_77389)[176]' = 0
((char*)&$heap_77389)[24]' = 0
((char*)&$heap_77389)[32]' = 0
((char*)&$heap_77389)[40]' = 0
((char*)&$heap_77389)[8]' = &$heap_77389
bytes_after(&$heap_77390)' = 184
$heap_77390' is allocated by malloc
$heap_77390' is allocated
bytes_before(&$heap_77390)' = 0
((char*)&$heap_77390)[16]' = 0
((char*)&$heap_77390)[176]' = 0
((char*)&$heap_77390)[24]' = 0
((char*)&$heap_77390)[32]' = 0
((char*)&$heap_77390)[40]' = 0
bytes_after(&$heap_77391)' = 184
$heap_77391' is allocated by malloc
$heap_77391' is allocated
bytes_before(&$heap_77391)' = 0
((char*)&$heap_77391)[16]' = 0
((char*)&$heap_77391)[176]' = 0
((char*)&$heap_77391)[24]' = 0
((char*)&$heap_77391)[32]' = 0
((char*)&$heap_77391)[40]' = 0
$heap_77392' = 112
bytes_after(&$heap_77392)' = 6
$heap_77392' is allocated by malloc
$heap_77392' is allocated
bytes_before(&$heap_77392)' = 0
strlen(&$heap_77392)' = 5
$heap_77393' = *myarchname
bytes_after(&$heap_77393)' = strlen(myarchname) + 1
$heap_77393' is allocated by malloc
$heap_77393' is allocated
bytes_before(&$heap_77393)' = 0
strlen(&$heap_77393)' = strlen(myarchname)
$heap_77394' = 1
bytes_after(&$heap_77394)' = 200
$heap_77394' is allocated by malloc
$heap_77394' is allocated
bytes_before(&$heap_77394)' = 0
strlen(&$heap_77394)' = 0
((char*)&$heap_77394)[136]' = &$heap_77395
((char*)&$heap_77394)[152]' = 1
((char*)&$heap_77394)[16]' = &$heap_77400
((char*)&$heap_77394)[168]' = 1000
((char*)&$heap_77394)[176]' = &$heap_77396
((char*)&$heap_77394)[76]' = pvmmydsig
((char*)&$heap_77394)[8]' = &$heap_77399
((char*)&$heap_77394)[84]' = pvmudpmtu
((char*)&$heap_77394)[88]' = 2
((char*)&$heap_77394)[104]' = 1
((char*)&$heap_77394)[108]' = 1
((char*)&$heap_77394)[112]' = &$heap_77397
((char*)&$heap_77394)[120]' = &$heap_77398
bytes_after(&$heap_77395)' = 184
$heap_77395' is allocated by malloc
$heap_77395' is allocated
bytes_before(&$heap_77395)' = 0
((char*)&$heap_77395)[16]' = 0
((char*)&$heap_77395)[176]' = 0
((char*)&$heap_77395)[24]' = 0
((char*)&$heap_77395)[32]' = 0
((char*)&$heap_77395)[40]' = 0
$heap_77396' = &$heap_77396
bytes_after(&$heap_77396)' = 32
$heap_77396' is allocated by malloc
$heap_77396' is allocated
bytes_before(&$heap_77396)' = 0
((char*)&$heap_77396)[16]' = 0
((char*)&$heap_77396)[20]' = 0
((char*)&$heap_77396)[24]' = 0
((char*)&$heap_77396)[8]' = &$heap_77396
bytes_after(&$heap_77397)' = 184
$heap_77397' is allocated by malloc
$heap_77397' is allocated
bytes_before(&$heap_77397)' = 0
((char*)&$heap_77397)[16]' = 0
((char*)&$heap_77397)[176]' = 0
((char*)&$heap_77397)[24]' = 0
((char*)&$heap_77397)[32]' = 0
((char*)&$heap_77397)[40]' = 0
bytes_after(&$heap_77398)' = 184
$heap_77398' is allocated by malloc
$heap_77398' is allocated
bytes_before(&$heap_77398)' = 0
((char*)&$heap_77398)[16]' = 0
((char*)&$heap_77398)[176]' = 0
((char*)&$heap_77398)[24]' = 0
((char*)&$heap_77398)[32]' = 0
((char*)&$heap_77398)[40]' = 0
$heap_77399' = *$param_1
bytes_after(&$heap_77399)' = strlen($param_1) + 1
$heap_77399' is allocated by malloc
$heap_77399' is allocated
bytes_before(&$heap_77399)' = 0
strlen(&$heap_77399)' = strlen($param_1)
$heap_77400' = *myarchname
bytes_after(&$heap_77400)' = strlen(myarchname) + 1
$heap_77400' is allocated by malloc
$heap_77400' is allocated
bytes_before(&$heap_77400)' = 0
strlen(&$heap_77400)' = strlen(myarchname)
hh' = &$unknown_807469
hn' = $param_1
hosts' = &$heap_77381
hp' = &$heap_77394
hp' = &$heap_77394
htp' = &$heap_77381
i' = $param_2
lh' = $input_21244
mask' = 0
mh' = $input_12
n' = 2




Change Warning 2669.2714 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: