Text  |   XML   |   Visible Warnings:

Irssi : Irssi analysis 1 : File System Race Condition  at settings.c:593

Categories: POSIX.RACE.TOCTTOU CWE:367
Warning ID: 2151.2154
Procedure: file_checksum
Trace: View
Modified: Wed Sep 2 11:51:35 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 irssi_config_is_changed
 620 int irssi_config_is_changed(const char *fname) 
 621 {
 622         struct stat statbuf;
 623  
 624         if (fname == NULL)
 625                 fname = mainconfig->fname;
 626  
true627         if (stat(fname, &statbuf) != 0)
 628                 return FALSE;
 629  
 630         return config_last_mtime != statbuf.st_mtime && 
 631                 (config_last_size != statbuf.st_size || 
*fname is checked by path name632                  config_last_checksum != file_checksum(fname));
     Enter irssi_config_is_changed / file_checksum
*$param_1 is checked by path name587   static unsigned int file_checksum(const char *fname) 
 588   {
 589           char buf[512];
 590           int f, ret, n;
 591           unsigned int checksum = 0;
 592    
*fname is checked by path name593           f = open(fname, O_RDONLY);     /* File System Race Condition */  /* File System Race Condition (ID: 2095.2096) */
     Exit irssi_config_is_changed / file_checksum
Preconditions
$param_1 = 0
statbuf.st_size = config_last_size
statbuf.st_mtim.tv_sec != config_last_mtime
Postconditions
*mainconfig->fname' is checked by path name
checksum' = 0
errno' != 0
fname' = mainconfig->fname
fname' = mainconfig->fname




Change Warning 2151.2154 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: