Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Null Pointer Dereference  at pvmd.c:5411

Categories: LANG.MEM.NPD CWE:476
Warning ID: 22080.28917
Procedure: master_config
Trace: view
Modified: Thu Nov 26 11:28:34 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
   /kat0/fletcher/SATE/2010/pvm3/src/pvmd.c
   Enter master_config
 5317 master_config(hn, argc, argv) 
 5318         char *hn;                       /* hostname or null */ 
 5319         int argc;
 5320         char **argv;
 5321 {
 5322         struct hostent *he;
 5323         struct hostd *hp;
 5324         struct hostd *hp2;
 5325         int i;
 5326         char *s;
 5327  
 5328         if (argc > 2) {
 5329                 pvmlogerror("usage: pvmd3 [-ddebugmask] [-nhostname] [hostfile]\n");
 5330                 pvmbailout(0);
 5331         }
 5332         if (argc == 2) {
 5333                 filehosts = readhostfile(argv[1]);
 5334         }
 5335         else if (s = getenv("PVMHOSTFILE")) {
 5336                 filehosts = readhostfile(s);
 5337         }
 5338         if (pvmdebmask & PDMSTARTUP) {
 5339                 if (filehosts) {
 5340                         pvmlogerror("master_config() host file:\n");
 5341                         ht_dump(filehosts);
 5342  
 5343                 } else 
 5344                         pvmlogerror("master_config() null host file\n");
 5345         }
 5346  
true5347         hosts = ht_new(1);
 5348         hosts->ht_serial = 1;
 5349         hosts->ht_master = 1;
 5350         hosts->ht_cons = 1;
 5351         hosts->ht_local = 1;
 5352  
 5353         hp = hd_new(1);
 5354         hp->hd_name = STRALLOC(hn);   /* Null Pointer Dereference (ID: 265.28929) */
 5355         hp->hd_arch = STRALLOC(myarchname);   /* Null Pointer Dereference (ID: 263.28928) */
 5356         hp->hd_mtu = pvmudpmtu;
 5357         hp->hd_dsig = pvmmydsig;
 5358         ht_insert(hosts, hp);
 5359         hd_unref(hp);
 5360  
 5361         hp = hd_new(0);
 5362         hp->hd_name = STRALLOC("pvmd'");   /* Null Pointer Dereference (ID: 264.28927) */
 5363         hp->hd_arch = STRALLOC(myarchname);   /* Null Pointer Dereference (ID: 263.28925) */
 5364         hp->hd_mtu = pvmudpmtu;
 5365         hp->hd_dsig = pvmmydsig;
 5366         ht_insert(hosts, hp);
 5367         hd_unref(hp);
 5368  
 5369         /*
 5370         * get attributes from host file if available 
 5371         */ 
 5372  
 5373         hp = hosts->ht_hosts[1];
 5374         if (filehosts &&
 5375                         ((hp2 = nametohost(filehosts, hp->hd_name)) 
 5376                         || (hp2 = filehosts->ht_hosts[0]))) {
 5377                 applydefaults(hp, hp2);
 5378         }
 5379  
 5380         if (!hp->hd_epath) {
 5381                 if ((s = getenv("PVM_PATH")))
 5382                         hp->hd_epath = STRALLOC(s);   /* Null Pointer Dereference (ID: 22087.28924) */
 5383                 else 
 5384                         hp->hd_epath = STRALLOC(DEFBINDIR);   /* Null Pointer Dereference (ID: 22086.28923) */
 5385         }
 5386         epaths = colonsep(varsub(hp->hd_epath));
 5387         if (!hp->hd_bpath)
 5388                 hp->hd_bpath = STRALLOC(DEFDEBUGGER);   /* Null Pointer Dereference (ID: 22083.28920) */
 5389         debugger = varsub(hp->hd_bpath);
 5390         if (!hp->hd_wdir) {
 5391                 if ((s = getenv("PVM_WD")))
 5392                         hp->hd_wdir = STRALLOC(s);   /* Null Pointer Dereference (ID: 22082.28919) */
 5393                 else 
 5394                         hp->hd_wdir = STRALLOC(pvmgethome());   /* Null Pointer Dereference (ID: 22081.28918) */
 5395         }
 5396         s = varsub(hp->hd_wdir);
 5397         if (chdir(s) == -1)
 5398                 pvmlogperror(s);
 5399         PVM_FREE(s);
 5400  
 5401         if (!(he = gethostbyname(hp->hd_aname ? hp->hd_aname : hp->hd_name))) {
 5402                 pvmlogprintf("master_config() %s: can't gethostbyname\n", hn);
 5403                 pvmbailout(0);
 5404         }
 5405  
 5406         BCOPY(he->h_addr_list[0], (char*)&hp->hd_sad.sin_addr,
 5407                 sizeof(struct in_addr));
 5408  
*hosts->ht_hosts <= 40355409         hp = hosts->ht_hosts[0];
 5410         BCOPY(he->h_addr_list[0], (char*)&hp->hd_sad.sin_addr,
hp <= 40355411                 sizeof(struct in_addr));     /* Null Pointer Dereference */
Preconditions
argc = 2
((char*)&((char*)$heap_201386)[4])[116] = 0
((char*)((char*)$heap_201386)[4])[8] <= 46
$unknown_758070 != 36
$unknown_758072 != 0
strlen(&$unknown_758072) > 0
$input_12 >= 0
$input_8476 >= 0
$input_8500 >= 0
Postconditions
((char*)&((char*)$heap_201386)[4])[24]' = &$unknown_758070
((char*)&((char*)$heap_201386)[4])[28]' = &$heap_201401
((char*)&((char*)$heap_201386)[4])[32]' = &$heap_201402
((char*)&((char*)$heap_201386)[4])[60]' = $input_8508
$unknown_758073' is freed
$unknown_758073' is accessed by path name
atnewline' = 1
epaths' = &$heap_201400
errno' != 0
filehosts' = &$unknown_758069
he' = &$heap_201403
$heap_201385' = 1
bytes_after(&$heap_201385)' = 32
$heap_201385' is allocated by malloc
$heap_201385' is allocated
bytes_before(&$heap_201385)' = 0
((char*)&$heap_201385)[16]' = 1
((char*)&$heap_201385)[20]' = 1
((char*)&$heap_201385)[28]' = &$heap_201386
((char*)&$heap_201385)[12]' = 1
$heap_201386' = 0
$heap_201386' is allocated
bytes_before(&$heap_201386)' = 0
$heap_201387' = &$heap_201387
bytes_after(&$heap_201387)' = 120
$heap_201387' is allocated by malloc
$heap_201387' is allocated
bytes_before(&$heap_201387)' = 0
((char*)&$heap_201387)[16]' = 0
((char*)&$heap_201387)[20]' = 0
((char*)&$heap_201387)[4]' = &$heap_201387
((char*)&$heap_201387)[8]' = 0
((char*)&$heap_201387)[116]' = 0
((char*)&$heap_201387)[12]' = 0
$heap_201388' = 1
bytes_after(&$heap_201388)' = 124
$heap_201388' is allocated by malloc
bytes_before(&$heap_201388)' = 0
((char*)&$heap_201388)[44]' = pvmmydsig
((char*)&$heap_201388)[52]' = pvmudpmtu
((char*)&$heap_201388)[56]' = 2
((char*)&$heap_201388)[72]' = 1
((char*)&$heap_201388)[76]' = 1
((char*)&$heap_201388)[80]' = &$heap_201387
((char*)&$heap_201388)[8]' = &$heap_201391
((char*)&$heap_201388)[84]' = &$heap_201389
((char*)&$heap_201388)[92]' = &$heap_201390
((char*)&$heap_201388)[100]' = 1
((char*)&$heap_201388)[108]' = 1000
((char*)&$heap_201388)[112]' = 0
((char*)&$heap_201388)[12]' = &$heap_201392
bytes_after(&$heap_201389)' = 120
$heap_201389' is allocated by malloc
$heap_201389' is allocated
bytes_before(&$heap_201389)' = 0
((char*)&$heap_201389)[16]' = 0
((char*)&$heap_201389)[20]' = 0
((char*)&$heap_201389)[8]' = 0
((char*)&$heap_201389)[116]' = 0
((char*)&$heap_201389)[12]' = 0
bytes_after(&$heap_201390)' = 120
$heap_201390' is allocated by malloc
$heap_201390' is allocated
bytes_before(&$heap_201390)' = 0
((char*)&$heap_201390)[16]' = 0
((char*)&$heap_201390)[20]' = 0
((char*)&$heap_201390)[8]' = 0
((char*)&$heap_201390)[116]' = 0
((char*)&$heap_201390)[12]' = 0
$heap_201391' = *hn
bytes_after(&$heap_201391)' = strlen(hn) + 1
$heap_201391' is allocated by malloc
$heap_201391' is allocated
bytes_before(&$heap_201391)' = 0
strlen(&$heap_201391)' = strlen(hn)
tocttou($heap_201391)' = tocttou(*hn)
$heap_201392' = *myarchname
bytes_after(&$heap_201392)' = strlen(myarchname) + 1
$heap_201392' is allocated by malloc
$heap_201392' is allocated
bytes_before(&$heap_201392)' = 0
strlen(&$heap_201392)' = strlen(myarchname)
tocttou($heap_201392)' = tocttou(*myarchname)
$heap_201393' = &$heap_201393
bytes_after(&$heap_201393)' = 120
$heap_201393' is allocated by malloc
$heap_201393' is allocated
bytes_before(&$heap_201393)' = 0
((char*)&$heap_201393)[16]' = 0
((char*)&$heap_201393)[20]' = 0
((char*)&$heap_201393)[4]' = &$heap_201393
((char*)&$heap_201393)[8]' = 0
((char*)&$heap_201393)[116]' = 0
((char*)&$heap_201393)[12]' = 0
bytes_after(&$heap_201394)' = 120
$heap_201394' is allocated by malloc
$heap_201394' is allocated
bytes_before(&$heap_201394)' = 0
((char*)&$heap_201394)[16]' = 0
((char*)&$heap_201394)[20]' = 0
((char*)&$heap_201394)[8]' = 0
((char*)&$heap_201394)[116]' = 0
((char*)&$heap_201394)[12]' = 0
$heap_201395' = 1
bytes_after(&$heap_201395)' = 124
$heap_201395' is allocated by malloc
bytes_before(&$heap_201395)' = 0
((char*)&$heap_201395)[44]' = pvmmydsig
((char*)&$heap_201395)[52]' = pvmudpmtu
((char*)&$heap_201395)[56]' = 2
((char*)&$heap_201395)[72]' = 1
((char*)&$heap_201395)[76]' = 1
((char*)&$heap_201395)[80]' = &$heap_201393
((char*)&$heap_201395)[8]' = &$heap_201397
((char*)&$heap_201395)[84]' = &$heap_201396
((char*)&$heap_201395)[92]' = &$heap_201394
((char*)&$heap_201395)[100]' = 1
((char*)&$heap_201395)[108]' = 1000
((char*)&$heap_201395)[112]' = 0
((char*)&$heap_201395)[12]' = &$heap_201398
$heap_201396' = &$heap_201396
bytes_after(&$heap_201396)' = 120
$heap_201396' is allocated by malloc
$heap_201396' is allocated
bytes_before(&$heap_201396)' = 0
((char*)&$heap_201396)[16]' = 0
((char*)&$heap_201396)[20]' = 0
((char*)&$heap_201396)[4]' = &$heap_201396
((char*)&$heap_201396)[8]' = 0
((char*)&$heap_201396)[116]' = 0
((char*)&$heap_201396)[12]' = 0
$heap_201397' = 112
bytes_after(&$heap_201397)' = 6
$heap_201397' is allocated by malloc
$heap_201397' is allocated
bytes_before(&$heap_201397)' = 0
strlen(&$heap_201397)' = 5
tocttou($heap_201397)' = tocttou(#string167)
$heap_201398' = *myarchname
bytes_after(&$heap_201398)' = strlen(myarchname) + 1
$heap_201398' is allocated by malloc
$heap_201398' is allocated
bytes_before(&$heap_201398)' = 0
strlen(&$heap_201398)' = strlen(myarchname)
tocttou($heap_201398)' = tocttou(*myarchname)
bytes_after(&$heap_201399)' = 8
$heap_201399' is allocated by malloc
bytes_before(&$heap_201399)' = 0
$heap_201400' is allocated by malloc
$heap_201400' is allocated
bytes_before(&$heap_201400)' = 0
$heap_201401' = 36
bytes_after(&$heap_201401)' = 23
$heap_201401' is allocated by malloc
$heap_201401' is allocated
bytes_before(&$heap_201401)' = 0
tocttou($heap_201401)' = tocttou(#string170)
$heap_201402' = $unknown_758072
bytes_after(&$heap_201402)' = strlen(&$unknown_758071) + 1
$heap_201402' is allocated by malloc
$heap_201402' is allocated
bytes_before(&$heap_201402)' = 0
$heap_201403' = &$heap_201404
bytes_after(&$heap_201403)' = 1024
$heap_201403' is a non-heap object
bytes_before(&$heap_201403)' = 0
((char*)&$heap_201403)[16]' = &$heap_201406
((char*)&$heap_201403)[4]' = &$heap_201407
$heap_201404' = $input_444
bytes_after(&$heap_201404)' = $input_12 + 1
$heap_201404' is allocated by malloc
$heap_201404' is a non-heap object
bytes_before(&$heap_201404)' = 0
strlen(&$heap_201404)' = $input_12
$heap_201405' = $input_8508
bytes_after(&$heap_201405)' = $input_8500 + 1
$heap_201405' is allocated by malloc
$heap_201405' is a non-heap object
bytes_before(&$heap_201405)' = 0
strlen(&$heap_201405)' = $input_8500
$heap_201406' = &$heap_201405
$heap_201406' is a non-heap object
bytes_before(&$heap_201406)' = 0
$heap_201407' = &$heap_201408
$heap_201407' is a non-heap object
bytes_before(&$heap_201407)' = 0
$heap_201408' = $input_8484
bytes_after(&$heap_201408)' = $input_8476 + 1
$heap_201408' is allocated by malloc
$heap_201408' is a non-heap object
bytes_before(&$heap_201408)' = 0
strlen(&$heap_201408)' = $input_8476
hosts' = &$heap_201385
hp' = 0
hp2' = ((char*)$unknown_758069)[28]
last_rv' = &$heap_201403
s' = &$unknown_758073
tmbuf.tm_sec' = &$unknown_758074




Change Warning 22080.28917 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: