Text  |   XML   |   Visible Warnings:

Irssi : Irssi analysis 1 : File System Race Condition  at parse.c:307

Categories: POSIX.RACE.TOCTTOU CWE:367
Warning ID: 2097.2098
Procedure: config_open
Trace: View
Modified: Wed Sep 2 11:51:11 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/irssi/irssi-0.8.14/src/core/settings.c
   Enter parse_configfile
 635 static CONFIG_REC *parse_configfile(const char *fname) 
 636 {
 637         CONFIG_REC *config;
 638         struct stat statbuf;
 639         const char *path;
 640         char *str;
 641  
 642         if (fname == NULL)
 643                 fname = get_irssi_config();
 644  
 645         if (stat(fname, &statbuf) == 0)
 646                 path = fname;
 647         else {
 648                 /* user configuration file not found, use the default one 
 649                    from sysconfdir */ 
 650                 path = SYSCONFDIR"/"IRSSI_GLOBAL_CONFIG;
true651                 if (stat(path, &statbuf) != 0) {
 652                         /* no configuration file in sysconfdir ..
 653                            use the build-in configuration */ 
 654                         path = NULL;
 655                 }
 656         }
 657  
*path is checked by path name658         config = config_open(path, -1);
     /u1/paul/SATE/2010/c/irssi/irssi-0.8.14/src/lib-config/parse.c
     Enter parse_configfile / config_open
*$param_1 is checked by path name301   CONFIG_REC *config_open(const char *fname, int create_mode) 
 302   {
 303           CONFIG_REC *rec;
 304           int f;
 305    
 306           if (fname != NULL) {
*fname is checked by path name307                   f = open(fname, O_RDONLY | (create_mode != -1 ? O_CREAT : 0), create_mode);     /* File System Race Condition */
     Exit parse_configfile / config_open
Preconditions
$param_1 = 0
irssi_config_file >= 0
Postconditions
*irssi_config_file' is checked by path name
create_mode' = -1
errno' != 0
fname' = &#string29[0]
fname' = irssi_config_file
path' = &#string29[0]




Change Warning 2097.2098 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: