Text  |   XML   |   Visible Warnings:

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

Categories: LANG.MEM.NPD CWE:476
Warning ID: 262.28914
Similar Warnings: 262.28915
Procedure: slave_config
Trace: view
Modified: Thu Nov 26 11:28:30 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  
true5506         hp = hd_new(mh);
hp <= 40955507         hp->hd_name = STRALLOC("?");     /* Null Pointer Dereference */
Preconditions
argc >= 3
Postconditions
ac' = 6
argc' = 6
atnewline' = 1
bad' = 0
errno' != 0
$heap_173594' = 0
bytes_after(&$heap_173594)' = 8
$heap_173594' is allocated by malloc
$heap_173594' is allocated
bytes_before(&$heap_173594)' = 0
$heap_173595' = 1
bytes_after(&$heap_173595)' = 32
$heap_173595' is allocated by malloc
$heap_173595' is allocated
bytes_before(&$heap_173595)' = 0
((char*)&$heap_173595)[16]' = $input_12
((char*)&$heap_173595)[20]' = $input_106556
((char*)&$heap_173595)[28]' = &$heap_173594
((char*)&$heap_173595)[4]' = 1
((char*)&$heap_173595)[12]' = $input_12
$heap_173596' = 63
bytes_after(&$heap_173596)' = 2
$heap_173596' is allocated by malloc
$heap_173596' is allocated
bytes_before(&$heap_173596)' = 0
strlen(&$heap_173596)' = 1
tocttou($heap_173596)' = tocttou(#string176)
hosts' = &$heap_173595
hp' = 0
i' = argc
lh' = $input_106556
mh' = $input_12
tmbuf.tm_sec' = &$unknown_733545




Change Warning 262.28914 : Null Pointer Dereference

Because they are very similar, this warning shares annotations with warning 262.28915.

Priority:
State:
Finding:
Owner:
Note: