Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at pvmlog.c:357

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2666.2711
Procedure: pvmsetlog
Trace: View
Modified: Wed Sep 2 12:42:43 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/pvmlog.c
   Enter pvmsetlog
 294 pvmsetlog(how) 
 295         int how;
 296 {
 297         char buf[255];
 298         char hna[128];
 299         char *pvmtmp;
 300         char *p;
 301  
 302 #ifdef  IMA_CSPP 
 303         int scid = get_scid();  /* default (system) subcomplex ID is 1) */ 
 304                                         /* differentiate logfile when not on system s/c */ 
 305 #endif 
 306  
 307         if (2 & how & ~log_how) {
 308                 pvmtmp = pvmgettmp();
 309 #ifdef  SHAREDTMP 
 310                 if (gethostname(hna, sizeof(hna)-1) == -1) {
 311                         pvmlogerror("pvmsetlog() can't gethostname()\n");
 312                         return 0;
 313                 }
 314                 if (p = CINDEX(hna, '.'))
 315                         *p = 0;
 316 #ifdef  IMA_CSPP 
 317                 if (scid > 1)
 318                         (void)sprintf(buf, PVMDLOGFILE_CSPP,
   ...
 322                         (void)sprintf(buf, PVMDLOGFILE, pvmtmp, pvm_useruid, hna); 
 323  
 324 #else   /*SHAREDTMP*/ 
 325 #ifdef  IMA_CSPP 
 326                 if (scid > 1)
 327                         (void)sprintf(buf, PVMDLOGFILE_CSPP,
 328                                         pvmtmp, pvm_useruid, scid);
 329                 else 
 330 #endif 
 331 #ifndef WIN32 
 332                 (void)sprintf(buf, PVMDLOGFILE, pvmtmp, pvm_useruid);
 333 #else 
 334                 (void)sprintf(buf, "%s\\pvml.%s", pvmtmp, username);     
 335 #endif           
 336 #endif  /*SHAREDTMP*/ 
 337  
 338                 /* Append a Virtual Machine ID, If Set */ 
 339                 if ( p = getenv("PVM_VMID") ) {
 340                         strcat( buf, "." );
 341                         strcat( buf, p );
 342                 }
 343  
 344                 if ((log_fd = open(buf,
 345                                 O_WRONLY|O_TRUNC|O_CREAT|O_EXCL|O_APPEND, 0600)) != -1)
true346                         log_ff = fdopen(log_fd, "a");
 347                 else 
 348                         how &= ~2;
 349  
 350                 if (p = getenv("PVMDLOGMAX"))
 351                         pvmdlogmax = atoi(p);
 352  
 353                 pvmdlogmax = pvmdlogmax;  /* for picky SGI compiler warning */ 
 354         }
 355  
 356         if (2 & log_how & ~how) {
log_ff <= 4095357                 (void)fclose(log_ff);     /* Null Pointer Dereference */
Preconditions
$input_10964 >= 0
$input_12 >= 0
td = 0
Postconditions
buf[0]' is opened
errno' != 0
$heap_46673' = $input_60
bytes_after(&$heap_46673)' = $input_12 + 1
$heap_46673' is allocated by malloc
$heap_46673' is a non-heap object
bytes_before(&$heap_46673)' = 0
strlen(&$heap_46673)' = $input_12
$heap_46674' is allocated by open
$heap_46674' is allocated
((char*)&$heap_46674)[-4096]' is open
$heap_46675' = $input_10972
bytes_after(&$heap_46675)' = $input_10964 + 1
$heap_46675' is allocated by malloc
$heap_46675' is a non-heap object
bytes_before(&$heap_46675)' = 0
strlen(&$heap_46675)' = $input_10964
how' = $param_1
log_fd' = &$heap_46674 - 4096
log_ff' = 0
p' = &$heap_46675
pvmdlogmax' = $input_10980
pvmtmp' = &#string21[0]
td' = &#string21[0]




Change Warning 2666.2711 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: