Text  |   XML   |   Visible Warnings:

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

Categories: LANG.MEM.NPD CWE:476
Warning ID: 22070.28899
Procedure: slave_config
Trace: view
Modified: Thu Nov 26 11:28:25 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 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]);
 5500         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: 262.28915) */
 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: 261.28913) */
 5515         hp->hd_arch = STRALLOC(myarchname);   /* Null Pointer Dereference (ID: 260.28911) */
 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: 259.28909) */
 5524         hp->hd_arch = STRALLOC(myarchname);   /* Null Pointer Dereference (ID: 260.28908) */
 5525         hp->hd_mtu = pvmudpmtu;
 5526         hp->hd_dsig = pvmmydsig;
 5527         hex_inadport(argv[5], &hp->hd_sad);
 5528         ht_insert(hosts, hp);
 5529         hd_unref(hp);
 5530  
 5531         if (i = mksocs()) {
 5532                 if (i == 2) {
 5533                         printf("PvmDupHost\n");
 5534                         fflush(stdout);
 5535                 }
 5536                 pvmbailout(0);
 5537         }
 5538  
 5539         printf("ddpro<%d> arch<%s> ip<%s> mtu<%d> dsig<%d>\n",
 5540                 DDPROTOCOL,
 5541                 myarchname,
 5542                 inadport_hex(&hp->hd_sad),
 5543                 pvmudpmtu,
 5544                 pvmmydsig);
 5545         fflush(stdout);
 5546  
 5547 #ifndef WIN32 
 5548  
 5549 #if !defined(IMA_OS2) && !defined(CYGWIN)
 5550         if (!ms)
 5551                 (void)read(0, (char*)&i, 1);
 5552 #endif 
 5553  
 5554         if (dof) {
 5555                 if (i = fork()) {
 5556                         if (i == -1)
 5557                                 pvmlogperror("slave_config() fork");
 5558                         exit(0);
 5559                 }
 5560  
 5561         /* close everything but our sockets */ 
 5562  
 5563                 for (i = getdtablesize(); --i >= 0; )
 5564 /* XXX don't like this - hard to maintain */ 
 5565                         if (i != netsock && i != loclsock && i != log_fd)
 5566                                 (void)close(i);
 5567         }
 5568  
 5569         /* reopen 0, 1, 2*/ 
 5570  
 5571         (void)open("/dev/null", O_RDONLY, 0);
 5572         (void)open("/dev/null", O_WRONLY, 0);   /* File System Race Condition (ID: 22074.28903) */
 5573         (void)dup2(1, 2);
 5574  
 5575 #endif 
 5576  
 5577         pvmsetlog(2);
 5578  
 5579         if ((p = getenv("PVM_PATH")))
 5580                 s = STRALLOC(p);   /* Null Pointer Dereference (ID: 22072.28901) */
 5581         else 
 5582                 s = STRALLOC(DEFBINDIR);   /* Null Pointer Dereference (ID: 22073.28902) */
 5583         epaths = colonsep(varsub(s));
 5584         PVM_FREE(s);
 5585  
 5586         s = STRALLOC(DEFDEBUGGER);   /* Null Pointer Dereference (ID: 22071.28900) */
 5587         debugger = varsub(s);
 5588         PVM_FREE(s);
 5589  
 5590         if ((s = getenv("PVM_WD")))
true5591                 p = STRALLOC(s);     /* Null Pointer Dereference */
Preconditions
argc >= 3
&$unknown_724843 != 0
*argv[5] != 58
*argv[2] != 58
$unknown_724845 != 58
((char*)&$heap_110676)[20] != 0
((char*)&$heap_110676)[96] >= 0
$input_72972 >= 0
Postconditions
((char*)$heap_110676)[20]' is freed
*stdout' is allocated by fopen
bytes_before(stdout)' = 0
ac' = 6
argc' = 6
bad' = 0
strlen(&buf[0])' = 17
buf[17]' = 0
debugger' = &$unknown_724846
dof' = &$unknown_724843
epaths' = &$heap_110690
errno' != 0
$heap_110668' = 1
bytes_after(&$heap_110668)' = 32
$heap_110668' is allocated by malloc
$heap_110668' is allocated
bytes_before(&$heap_110668)' = 0
((char*)&$heap_110668)[16]' = $input_12
((char*)&$heap_110668)[20]' = $input_72956
((char*)&$heap_110668)[12]' = $input_12
bytes_after(&$heap_110670)' = 120
$heap_110670' is allocated by malloc
$heap_110670' is allocated
bytes_before(&$heap_110670)' = 0
((char*)&$heap_110670)[16]' = 0
((char*)&$heap_110670)[20]' = 0
((char*)&$heap_110670)[8]' = 0
((char*)&$heap_110670)[116]' = 0
((char*)&$heap_110670)[12]' = 0
bytes_after(&$heap_110671)' = 120
$heap_110671' is allocated by malloc
$heap_110671' is allocated
bytes_before(&$heap_110671)' = 0
((char*)&$heap_110671)[16]' = 0
((char*)&$heap_110671)[20]' = 0
((char*)&$heap_110671)[8]' = 0
((char*)&$heap_110671)[116]' = 0
((char*)&$heap_110671)[12]' = 0
$heap_110672' = 1
bytes_after(&$heap_110672)' = 124
$heap_110672' is allocated by malloc
bytes_before(&$heap_110672)' = 0
((char*)&$heap_110672)[52]' = $input_72964
((char*)&$heap_110672)[56]' = 2
((char*)&$heap_110672)[72]' = 1
((char*)&$heap_110672)[76]' = 1
((char*)&$heap_110672)[80]' = &$heap_110670
((char*)&$heap_110672)[8]' = &$heap_110674
((char*)&$heap_110672)[84]' = &$heap_110673
((char*)&$heap_110672)[92]' = &$heap_110671
((char*)&$heap_110672)[100]' = 1
((char*)&$heap_110672)[108]' = 1000
((char*)&$heap_110672)[112]' = 0
$heap_110673' = &$heap_110673
bytes_after(&$heap_110673)' = 120
$heap_110673' is allocated by malloc
$heap_110673' is allocated
bytes_before(&$heap_110673)' = 0
((char*)&$heap_110673)[16]' = 0
((char*)&$heap_110673)[20]' = 0
((char*)&$heap_110673)[4]' = &$heap_110673
((char*)&$heap_110673)[8]' = 0
((char*)&$heap_110673)[116]' = 0
((char*)&$heap_110673)[12]' = 0
$heap_110674' = 63
bytes_after(&$heap_110674)' = 2
$heap_110674' is allocated by malloc
$heap_110674' is allocated
bytes_before(&$heap_110674)' = 0
strlen(&$heap_110674)' = 1
tocttou($heap_110674)' = tocttou(#string176)
bytes_after(&$heap_110675)' = 120
$heap_110675' is allocated by malloc
bytes_before(&$heap_110675)' = 0
$heap_110676' = 0
bytes_after(&$heap_110676)' = 124
$heap_110676' is allocated by malloc
$heap_110676' is freed
bytes_before(&$heap_110676)' = 0
((char*)&$heap_110676)[44]' = pvmmydsig
((char*)&$heap_110676)[52]' = pvmudpmtu
((char*)&$heap_110676)[56]' = 2
((char*)&$heap_110676)[72]' = 1
((char*)&$heap_110676)[76]' = 1
((char*)&$heap_110676)[80]' = &$heap_110675
((char*)&$heap_110676)[8]' = &$heap_110679
((char*)&$heap_110676)[84]' = &$heap_110677
((char*)&$heap_110676)[92]' = &$heap_110678
((char*)&$heap_110676)[100]' = 1
((char*)&$heap_110676)[108]' = 1000
((char*)&$heap_110676)[112]' = 0
((char*)&$heap_110676)[12]' = &$heap_110680
$heap_110677' = &$heap_110677
bytes_after(&$heap_110677)' = 120
$heap_110677' is allocated by malloc
bytes_before(&$heap_110677)' = 0
((char*)&$heap_110677)[16]' = 0
((char*)&$heap_110677)[20]' = 0
((char*)&$heap_110677)[4]' = &$heap_110677
((char*)&$heap_110677)[116]' = 0
bytes_after(&$heap_110678)' = 120
$heap_110678' is allocated by malloc
bytes_before(&$heap_110678)' = 0
((char*)&$heap_110678)[16]' = 0
((char*)&$heap_110678)[20]' = 0
((char*)&$heap_110678)[116]' = 0
$heap_110679' = 112
bytes_after(&$heap_110679)' = 6
$heap_110679' is allocated by malloc
bytes_before(&$heap_110679)' = 0
strlen(&$heap_110679)' = 5
tocttou($heap_110679)' = tocttou(#string167)
$heap_110680' = *myarchname
bytes_after(&$heap_110680)' = strlen(myarchname) + 1
$heap_110680' is allocated by malloc
bytes_before(&$heap_110680)' = 0
strlen(&$heap_110680)' = strlen(myarchname)
tocttou($heap_110680)' = tocttou(*myarchname)
bytes_after(&$heap_110681)' = 120
$heap_110681' is allocated by malloc
$heap_110681' is allocated
bytes_before(&$heap_110681)' = 0
((char*)&$heap_110681)[16]' = 0
((char*)&$heap_110681)[20]' = 0
((char*)&$heap_110681)[8]' = 0
((char*)&$heap_110681)[116]' = 0
((char*)&$heap_110681)[12]' = 0
$heap_110682' = &$heap_110682
bytes_after(&$heap_110682)' = 120
$heap_110682' is allocated by malloc
$heap_110682' is allocated
bytes_before(&$heap_110682)' = 0
((char*)&$heap_110682)[16]' = 0
((char*)&$heap_110682)[20]' = 0
((char*)&$heap_110682)[4]' = &$heap_110682
((char*)&$heap_110682)[8]' = 0
((char*)&$heap_110682)[116]' = 0
((char*)&$heap_110682)[12]' = 0
$heap_110683' = &$heap_110683
bytes_after(&$heap_110683)' = 120
$heap_110683' is allocated by malloc
$heap_110683' is allocated
bytes_before(&$heap_110683)' = 0
((char*)&$heap_110683)[16]' = 0
((char*)&$heap_110683)[20]' = 0
((char*)&$heap_110683)[4]' = &$heap_110683
((char*)&$heap_110683)[8]' = 0
((char*)&$heap_110683)[116]' = 0
((char*)&$heap_110683)[12]' = 0
$heap_110684' = 1
bytes_after(&$heap_110684)' = 124
$heap_110684' is allocated by malloc
bytes_before(&$heap_110684)' = 0
((char*)&$heap_110684)[44]' = pvmmydsig
((char*)&$heap_110684)[52]' = pvmudpmtu
((char*)&$heap_110684)[56]' = 2
((char*)&$heap_110684)[72]' = 1
((char*)&$heap_110684)[76]' = 1
((char*)&$heap_110684)[80]' = &$heap_110682
((char*)&$heap_110684)[8]' = &$heap_110686
((char*)&$heap_110684)[84]' = &$heap_110683
((char*)&$heap_110684)[92]' = &$heap_110681
((char*)&$heap_110684)[100]' = 1
((char*)&$heap_110684)[108]' = 1000
((char*)&$heap_110684)[112]' = &$heap_110685
((char*)&$heap_110684)[12]' = &$heap_110687
bytes_after(&$heap_110685)' = 20
$heap_110685' is allocated by malloc
$heap_110685' is allocated
bytes_before(&$heap_110685)' = 0
((char*)&$heap_110685)[16]' = 0
((char*)&$heap_110685)[8]' = 0
((char*)&$heap_110685)[12]' = 0
$heap_110686' = *hn
bytes_after(&$heap_110686)' = strlen(hn) + 1
$heap_110686' is allocated by malloc
$heap_110686' is allocated
bytes_before(&$heap_110686)' = 0
strlen(&$heap_110686)' = strlen(hn)
tocttou($heap_110686)' = tocttou(*hn)
$heap_110687' = *myarchname
bytes_after(&$heap_110687)' = strlen(myarchname) + 1
$heap_110687' is allocated by malloc
$heap_110687' is allocated
bytes_before(&$heap_110687)' = 0
strlen(&$heap_110687)' = strlen(myarchname)
tocttou($heap_110687)' = tocttou(*myarchname)
$heap_110688' is allocated by open
$heap_110688' is allocated
$heap_110689' = 36
bytes_after(&$heap_110689)' = 49
$heap_110689' is allocated by malloc
$heap_110689' is freed
bytes_before(&$heap_110689)' = 0
tocttou($heap_110689)' = tocttou(#string168)
$heap_110690' = &$unknown_724845
$heap_110690' is allocated by malloc
$heap_110690' is allocated
bytes_before(&$heap_110690)' = 0
((char*)&$heap_110690)[4]' = 0
$heap_110691' = 36
bytes_after(&$heap_110691)' = 23
$heap_110691' is allocated by malloc
$heap_110691' is freed
bytes_before(&$heap_110691)' = 0
tocttou($heap_110691)' = tocttou(#string170)
$heap_110692' = $input_444
bytes_after(&$heap_110692)' = $input_72972 + 1
$heap_110692' is allocated by malloc
$heap_110692' is a non-heap object
bytes_before(&$heap_110692)' = 0
strlen(&$heap_110692)' = $input_72972
hosts' = &$heap_110668
hp' = &$heap_110684
i' = -1
lh' = $input_72956
log_ff' = 0
log_how' = 2
mh' = $input_12
ms' = 1
p' = 0
s' = &$heap_110692




Change Warning 22070.28899 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: