Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at pvmd.c:5397

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2675.2724
Procedure: master_config
Trace: View
Modified: Wed Sep 2 12:43:10 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 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  
 5347         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: 2687.2738) */
 5355         hp->hd_arch = STRALLOC(myarchname);   /* Null Pointer Dereference (ID: 2685.2737) */
 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: 2686.2736) */
 5363         hp->hd_arch = STRALLOC(myarchname);   /* Null Pointer Dereference (ID: 2685.2734) */
 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: 2683.2732) */
 5383                 else 
 5384                         hp->hd_epath = STRALLOC(DEFBINDIR);   /* Null Pointer Dereference (ID: 2682.2731) */
 5385         }
 5386         epaths = colonsep(varsub(hp->hd_epath));
 5387         if (!hp->hd_bpath)
 5388                 hp->hd_bpath = STRALLOC(DEFDEBUGGER);   /* Null Pointer Dereference (ID: 2680.2729) */
 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: 2679.2728) */
 5393                 else 
 5394                         hp->hd_wdir = STRALLOC(pvmgethome());   /* Null Pointer Dereference (ID: 2678.2727) */
 5395         }
true5396         s = varsub(hp->hd_wdir);
s <= 40955397         if (chdir(s) == -1)     /* Null Pointer Dereference */
Preconditions
$param_2 = 2
&$unknown_844680 != 0
$unknown_844678 != 0
$unknown_844678 != 36
strlen(&$unknown_844678) = 1
((char*)&$unknown_844678)[1] = 0
((char*)&$heap_110480)[8] >= -1
((char*)&$heap_110488)[144] >= 0
((char*)&$heap_110488)[32] = 0
$input_12 >= 1
$input_60 = &$unknown_844680
Postconditions
((char*)&$unknown_844676)[40]' = &$heap_110494
((char*)&$unknown_844676)[48]' = &$heap_110496
((char*)&$unknown_844676)[56]' = &$heap_110498
argc' = $param_2
argv' = $param_3
debugger' = 0
epaths' = &$heap_110495
filehosts' = &$unknown_844675
$heap_110480' = 1
bytes_after(&$heap_110480)' = 40
$heap_110480' is allocated by malloc
$heap_110480' is allocated
bytes_before(&$heap_110480)' = 0
strlen(&$heap_110480)' = 0
((char*)&$heap_110480)[16]' = 1
((char*)&$heap_110480)[20]' = 1
((char*)&$heap_110480)[8]' = ((char*)&$heap_110480)[8] + 1
((char*)&$heap_110480)[12]' = 1
$heap_110482' = 1
bytes_after(&$heap_110482)' = 200
$heap_110482' is allocated by malloc
bytes_before(&$heap_110482)' = 0
strlen(&$heap_110482)' = 0
((char*)&$heap_110482)[136]' = &$heap_110483
((char*)&$heap_110482)[152]' = 1
((char*)&$heap_110482)[16]' = &$heap_110487
((char*)&$heap_110482)[168]' = 1000
((char*)&$heap_110482)[176]' = 0
((char*)&$heap_110482)[76]' = pvmmydsig
((char*)&$heap_110482)[8]' = &$heap_110486
((char*)&$heap_110482)[84]' = pvmudpmtu
((char*)&$heap_110482)[88]' = 2
((char*)&$heap_110482)[104]' = 1
((char*)&$heap_110482)[108]' = 1
((char*)&$heap_110482)[112]' = &$heap_110485
((char*)&$heap_110482)[120]' = &$heap_110484
$heap_110483' = &$heap_110483
bytes_after(&$heap_110483)' = 184
$heap_110483' is allocated by malloc
$heap_110483' is allocated
bytes_before(&$heap_110483)' = 0
((char*)&$heap_110483)[16]' = 0
((char*)&$heap_110483)[176]' = 0
((char*)&$heap_110483)[24]' = 0
((char*)&$heap_110483)[32]' = 0
((char*)&$heap_110483)[40]' = 0
((char*)&$heap_110483)[8]' = &$heap_110483
bytes_after(&$heap_110484)' = 184
$heap_110484' is allocated by malloc
$heap_110484' is allocated
bytes_before(&$heap_110484)' = 0
((char*)&$heap_110484)[16]' = 0
((char*)&$heap_110484)[176]' = 0
((char*)&$heap_110484)[24]' = 0
((char*)&$heap_110484)[32]' = 0
((char*)&$heap_110484)[40]' = 0
bytes_after(&$heap_110485)' = 184
$heap_110485' is allocated by malloc
$heap_110485' is allocated
bytes_before(&$heap_110485)' = 0
((char*)&$heap_110485)[16]' = 0
((char*)&$heap_110485)[176]' = 0
((char*)&$heap_110485)[24]' = 0
((char*)&$heap_110485)[32]' = 0
((char*)&$heap_110485)[40]' = 0
$heap_110486' = *$param_1
bytes_after(&$heap_110486)' = strlen($param_1) + 1
$heap_110486' is allocated by malloc
$heap_110486' is allocated
bytes_before(&$heap_110486)' = 0
strlen(&$heap_110486)' = strlen($param_1)
$heap_110487' = *myarchname
bytes_after(&$heap_110487)' = strlen(myarchname) + 1
$heap_110487' is allocated by malloc
$heap_110487' is allocated
bytes_before(&$heap_110487)' = 0
strlen(&$heap_110487)' = strlen(myarchname)
$heap_110488' = 0
bytes_after(&$heap_110488)' = 200
$heap_110488' is allocated by malloc
$heap_110488' is freed
bytes_before(&$heap_110488)' = 0
strlen(&$heap_110488)' = 0
((char*)&$heap_110488)[136]' = &$heap_110491
((char*)&$heap_110488)[152]' = 1
((char*)&$heap_110488)[16]' = &$heap_110493
((char*)&$heap_110488)[168]' = 1000
((char*)&$heap_110488)[176]' = 0
((char*)&$heap_110488)[76]' = pvmmydsig
((char*)&$heap_110488)[8]' = &$heap_110492
((char*)&$heap_110488)[84]' = pvmudpmtu
((char*)&$heap_110488)[88]' = 2
((char*)&$heap_110488)[104]' = 1
((char*)&$heap_110488)[108]' = 1
((char*)&$heap_110488)[112]' = &$heap_110490
((char*)&$heap_110488)[120]' = &$heap_110489
bytes_after(&$heap_110489)' = 184
$heap_110489' is allocated by malloc
bytes_before(&$heap_110489)' = 0
((char*)&$heap_110489)[176]' = 0
((char*)&$heap_110489)[32]' = 0
((char*)&$heap_110489)[40]' = 0
bytes_after(&$heap_110490)' = 184
$heap_110490' is allocated by malloc
bytes_before(&$heap_110490)' = 0
((char*)&$heap_110490)[16]' = 0
((char*)&$heap_110490)[176]' = 0
((char*)&$heap_110490)[24]' = 0
((char*)&$heap_110490)[32]' = 0
((char*)&$heap_110490)[40]' = 0
bytes_after(&$heap_110491)' = 184
$heap_110491' is allocated by malloc
bytes_before(&$heap_110491)' = 0
((char*)&$heap_110491)[176]' = 0
((char*)&$heap_110491)[32]' = 0
((char*)&$heap_110491)[40]' = 0
$heap_110492' = 112
bytes_after(&$heap_110492)' = 6
$heap_110492' is allocated by malloc
bytes_before(&$heap_110492)' = 0
strlen(&$heap_110492)' = 5
$heap_110493' = *myarchname
bytes_after(&$heap_110493)' = strlen(myarchname) + 1
$heap_110493' is allocated by malloc
bytes_before(&$heap_110493)' = 0
strlen(&$heap_110493)' = strlen(myarchname)
$heap_110494' = 36
bytes_after(&$heap_110494)' = 49
$heap_110494' is allocated by malloc
$heap_110494' is allocated
bytes_before(&$heap_110494)' = 0
bytes_after(&$heap_110495)' = 16
$heap_110495' is allocated by malloc
$heap_110495' is allocated
bytes_before(&$heap_110495)' = 0
$heap_110496' = 36
bytes_after(&$heap_110496)' = 23
$heap_110496' is allocated by malloc
$heap_110496' is allocated
bytes_before(&$heap_110496)' = 0
$heap_110497' = $input_60
bytes_after(&$heap_110497)' = $input_12 + 1
$heap_110497' is allocated by malloc
$heap_110497' is a non-heap object
bytes_before(&$heap_110497)' = 0
strlen(&$heap_110497)' = $input_12
$heap_110498' = &$unknown_844680
bytes_after(&$heap_110498)' = $input_12 + 1
$heap_110498' is allocated by malloc
$heap_110498' is allocated
bytes_before(&$heap_110498)' = 0
hn' = $param_1
hosts' = &$heap_110480
hp' = &$unknown_844676
hp2' = ((char*)$unknown_844675)[32]
s' = 0




Change Warning 2675.2724 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: