Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Null Pointer Dereference  at lpvmgen.c:3126

Categories: LANG.MEM.NPD CWE:476
Warning ID: 383.29087
Procedure: pvmgetenvars
Trace: view
Modified: Thu Nov 26 11:31:45 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/lpvmgen.c
   Enter pvmgetenvars
 3098 pvmgetenvars(ep) 
 3099         char ***ep;
 3100 {
 3101         char **xpl;                     /* vars to export */ 
 3102         int mxpl;                       /* cur length of xpl */ 
 3103         int nxpl;                       /* num vars found */ 
 3104         char buf[200];
 3105         char *p, *q;
 3106         int n;
 3107  
 3108         if (p = getenv("PVM_EXPORT")) {
 3109                 mxpl = 5;
 3110                 xpl = TALLOC(mxpl, char *, "env");
 3111                 xpl[0] = p - 11;   /* Null Pointer Dereference (ID: 388.29092) */
 3112                 nxpl = 1;
 3113                 while (1) {
 3114                         while (*p == ':')
 3115                                 p++;
 3116                         if (!*p)
 3117                                 break;
 3118                         n = (q = CINDEX(p, ':')) ? q - p : strlen(p);
 3119                         strncpy(buf, p, n);   /* No Space For Null Terminator (ID: 22125.29091) */  /* Buffer Overrun (ID: 386.29090) */
 3120                         buf[n] = 0;   /* Buffer Overrun (ID: 385.29089) */
 3121                         if (q = getenv(buf)) {
 3122                                 if (nxpl == mxpl) {
 3123                                         mxpl += mxpl / 2 + 1;
true3124                                         xpl = TREALLOC(xpl, mxpl, char *);   /* Integer Overflow of Allocation Size (ID: 384.29088) */
 3125                                 }
xpl <= 40953126                                 xpl[nxpl++] = q - n - 1;     /* Null Pointer Dereference */
 3127                         }
 3128                         p += n;
Preconditions
&$unknown_4397861 != 0
$unknown_4397862 = 58
strlen(&$unknown_4397862) >= 3
((char*)&$unknown_4397862)[2] != 0
((char*)&$unknown_4397862)[2] != 58
((char*)&$unknown_4397862)[1] = 58
$input_12 >= 1
$input_342412 >= 0
$input_444 = &$unknown_4397861
Postconditions
buf[0]' = ((char*)&$unknown_4397862)[2]
strlen(&buf[0])' = strlen(&$unknown_4397862) - 2
errno' != 0
$heap_370194' = &$unknown_4397861
bytes_after(&$heap_370194)' = $input_12 + 1
$heap_370194' is allocated by malloc
bytes_before(&$heap_370194)' = 0
strlen(&$heap_370194)' = $input_12
$heap_370195' = &$heap_370194 - 11
bytes_before(&$heap_370195)' = 0
$heap_370196' = $input_342420
bytes_after(&$heap_370196)' = $input_342412 + 1
$heap_370196' is allocated by malloc
$heap_370196' is a non-heap object
bytes_before(&$heap_370196)' = 0
strlen(&$heap_370196)' = $input_342412
n' = strlen(&$unknown_4397862) - 2
p' = &$unknown_4397862 + 2
q' = &$heap_370196
xpl' = 0




Change Warning 383.29087 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: