Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Redundant Condition  at pvmcruft.c:1405

Categories: LANG.STRUCT.RC CWE:570 CWE:571
Warning ID: 171.28793
Procedure: pvmmatchstring
Trace: view
Modified: Thu Nov 26 11:27:57 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 pvmmatchstring
 1392 pvmmatchstring( str, pattern ) 
 1393 char *str;
 1394 char *pattern;
 1395 {
 1396         char *start;
 1397         char *save;
 1398         char *x;
 1399         char *y;
 1400  
 1401         /* Find Start of Search String (Ignore Preceding '*'s) */ 
 1402  
 1403         start = pattern;
 1404  
Always True: *start != 01405         while ( *start == '*' && *start != '\0' )     /* Redundant Condition */  /* Null Pointer Dereference (ID: 181.28807) */
 1406                 start++;
 1407  
 1408         /* Null Search - Always Matches */ 
 1409  
 1410         if ( *start == '\0' )
 1411                 return( 1 );
 1412  
 1413         /* Initialize Pointers */ 
 1414  
 1415         x = str;
 1416  
 1417         y = start;
 1418  
 1419         /* Search Line for Start of Search String */ 
 1420  
 1421         while ( *x != '\0' )
 1422         {
 1423                 /* Starting Match Found...  Check it Out */ 
 1424  
 1425                 if ( *x == *y )
 1426                 {
 1427                         /* Save Continuation Pointer */ 
 1428  
 1429                         save = x + 1;
 1430  
 1431                         /* Traverse Line Until No Longer Matches */ 
 1432  
 1433                         while ( *x != '\0' && *y != '\0' && *x == *y )
 1434                         {
 1435                                 x++;
 1436                                 y++;
 1437  
 1438                                 /* Nested '*' Search Expansion */ 
 1439  
 1440                                 if ( *y == '*' )
 1441                                 {
 1442                                         if ( pvmmatchstring( x, y + 1 ) )
 1443                                                 return( 1 );
 1444  
 1445                                         else 
 1446                                                 break;
 1447                                 }
 1448  
 1449                                 /* Skip Over '\' for Escaped '*'s */ 
 1450  
 1451                                 else if ( *y == '\\' && *(y+1) == '*' )
 1452                                         y++;
 1453                         }
 1454  
 1455                         /* It's a Match! */ 
 1456  
 1457                         if ( *y == '\0' )
 1458                                 return( 1 );
 1459  
 1460                         /* Reset and Continue */ 
 1461  
 1462                         x = save;
 1463  
 1464                         y = start;
 1465                 }
 1466  
 1467                 else 
 1468                         x++;
 1469         }
 1470  
 1471         return( 0 );
 1472 } 




Change Warning 171.28793 : Redundant Condition

Priority:
State:
Finding:
Owner:
Note: