Text  |   XML   |   Visible Warnings:

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

Categories: POSIX.RACE.TOCTTOU CWE:367
Warning ID: 2095.2096
Procedure: file_checksum
Trace: View
Modified: Wed Sep 2 11:51:10 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_save_state
 605 static void irssi_config_save_state(const char *fname) 
 606 {
 607         struct stat statbuf;
 608  
 609         g_return_if_fail(fname != NULL);
 610  
true611         if (stat(fname, &statbuf) != 0)   /* stat After Open (ID: 2096.2097) */
 612                 return;
 613  
 614         /* save modify time, file size and checksum */ 
 615         config_last_mtime = statbuf.st_mtime;
 616         config_last_size = statbuf.st_size;
*fname is checked by path name617         config_last_checksum = file_checksum(fname);
     Enter irssi_config_save_state / 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: 2151.2154) */
     Exit irssi_config_save_state / file_checksum
Postconditions
_g_boolean_var_' = 1
checksum' = 0
config_last_mtime' = statbuf.st_mtim.tv_sec
config_last_size' = statbuf.st_size
errno' != 0
fname' = $param_1
fname' = $param_1




Change Warning 2095.2096 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: