Text  |   XML   |   Visible Warnings:

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

Categories: LANG.MEM.NPD CWE:476
Warning ID: 246.28883
Procedure: check_ext_input
Trace: view
Modified: Thu Nov 26 11:28:21 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 check_ext_input
 1264 check_ext_input() 
 1265 {
 1266         char input[256];
 1267  
 1268         char *ptr, *ptr2;
 1269  
 1270         char c;
 1271  
 1272         int flags;
 1273         int i;
 1274  
 1275         /* Set stdin Non-Blocking */ 
 1276  
 1277         flags = fcntl( 0, F_GETFL, 0 );
 1278  
 1279         fcntl( 0, F_SETFL, flags | O_NDELAY );
 1280  
 1281         /* Test for Input */ 
 1282  
 1283         i = 0;
 1284  
 1285         while ( (int)(input[i] = getc( stdin )) != (char) EOF 
 1286                         && input[i] != '\n' && i < 255 )
 1287                 i++;
 1288  
 1289         input[i] = '\0';
 1290  
 1291         /* Parse Extension Options Here */ 
 1292  
 1293         if ( i ) {
 1294                 ptr = input;
 1295                 while ( *ptr != '\0' )
 1296                 {
 1297                         /* Virtual Machine ID */ 
 1298                         if ( !strncmp( "PVM_VMID=", ptr, 9 ) ) {
 1299                                 ptr2 = ptr + 9;
 1300                                 while ( *ptr2 != ' ' && *ptr2 != '\t' && *ptr2 != '\0' )
 1301                                         ptr2++;
 1302                                 c = *ptr2;
 1303                                 *ptr2 = '\0';
true1304                                 pvmputenv(STRALLOC(ptr));     /* Null Pointer Dereference */
 1305                                 *ptr2 = c;
 1306                                 ptr = ptr2;
 1307                         }
 1308  
 1309                         /* Move Past Unknown Options */ 
 1310                         else 
 1311                                 while ( *ptr != ' ' && *ptr != '\t' && *ptr != '\0' )
 1312                                         ptr++;
 1313  
 1314                         /* Advance to Next Option */ 
 1315                         while ( *ptr == ' ' || *ptr == '\t' )
 1316                                 ptr++;
Preconditions
&$unknown_702774 >= &$unknown_702772 + 9
$unknown_702772 != 0
strlen(&$unknown_702772) > 9
((char*)&$unknown_702772)[9] != 0
((char*)&$unknown_702772)[9] != 32
((char*)&$unknown_702772)[9] != 9
$unknown_702774 != 0
$unknown_702774 != 32
$unknown_702774 != 9
((char*)&$unknown_702774)[2] = 32
((char*)&$unknown_702774)[1] != 0
((char*)&$unknown_702774)[1] != 32
((char*)&$unknown_702774)[1] != 9
input[0] != 0
$input_45772 = 255
$input_46180 <= 255
$input_46180 >= -1
Postconditions
*stdin' is allocated by fopen
bytes_before(stdin)' = 0
strlen(&$unknown_702774)' = 2
((char*)&$unknown_702774)[2]' = 0
c' = ((char*)&$unknown_702774)[2]
codesonar_distance_tweak' = 3
errno' != 0
flags' = -1
i' = $input_45772
input[255]' = 0
ptr' = &$unknown_702772
ptr2' = &$unknown_702774 + 2




Change Warning 246.28883 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: