Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Null Pointer Dereference  at pvmcruft.c:609

Categories: LANG.MEM.NPD CWE:476
Warning ID: 116.28736
Procedure: pvmenvinsert
Trace: view
Modified: Thu Nov 26 11:27:40 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/pvmcruft.c
   Enter pvmenvinsert
 575 pvmenvinsert(anep, s) 
 576         char ***anep;           /* environment pointer, may change (NOT environ) */ 
 577         char *s;                        /* string of form "NAME=Value" */ 
 578 {
 579         char **ep;
 580         char **newep;
 581         char *p;
 582         int l;                                          /* length of env var name or env */ 
 583  
 584         newep = *anep;
 585  
 586         if (!s || !(p = CINDEX(s, '=')))
 587                 return -1;
 588         l = p - s + 1;                  /* must include the '=' */ 
 589  
 590         /* search environ for name */ 
 591  
 592         for (ep = newep; *ep; ep++)
 593                 if (!strncmp(*ep, s, l))
 594                         break;
 595  
 596         if (*ep) {                              /* already there, replace it */ 
 597                 PVM_FREE(*ep);
 598                 *ep = STRALLOC(s);   /* Null Pointer Dereference (ID: 117.28737) */
 599  
 600         } else {                                /* not there, must extend environ */ 
 601  
 602         /* length needed is? */ 
 603  
 604                 for (l = 2, ep = newep; *ep; l++, ep++);
 605  
 606                 if (!(newep = TREALLOC((char *)newep, l, char *)))
 607                         return -1;
 608  
true609                 newep[l - 2] = STRALLOC(s);     /* Null Pointer Dereference */
Preconditions
&$unknown_395906 != 0
&$unknown_395909 >= *anep
*s != 61
strlen(s) > 0
$unknown_395909 != 0
((char*)&$unknown_395909)[4] != 0
((char*)&$unknown_395909)[8] = 0
Postconditions
ep' = &$unknown_395909 + 8
errno' != 0
$heap_58470' = **anep
$heap_58470' is allocated by malloc
$heap_58470' is allocated
bytes_before(&$heap_58470)' = 0
newep' = &$heap_58470
p' = &$unknown_395906




Change Warning 116.28736 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: