Text   |  XML   |  ReML   |   Visible Warnings:

File System Race Condition  at filesystem.c:1136

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

create_persconffile_profile

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/filesystem.c)expand/collapse
Show more  
 1079  create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
 1080  {
 1081          const char *pf_dir_path;
 1082  #ifdef _WIN32 
 1083          char *pf_dir_path_copy, *pf_dir_parent_path;
 1084          size_t pf_dir_parent_path_len;
 1085  #endif
 1086          struct stat s_buf;
 1087          int ret;
 1088   
 1089          if (profilename) {
 1090                  /*
 1091                   * Check if profiles directory exists.
 1092                   * If not then create it.
 1093                   */
 1094                  pf_dir_path = get_profiles_dir ();
 1095                  if (ws_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) {
 1096                          ret = ws_mkdir(pf_dir_path, 0755);
 1097                          if (ret == -1) {
 1098                                  *pf_dir_path_return = g_strdup(pf_dir_path);
 1099                                  return ret;
 1100                          }
 1101                  }
 1102          }
 1103   
 1104[+]         pf_dir_path = get_persconffile_dir(profilename);
 1105          if (ws_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) {
 1106  #ifdef _WIN32 
 1107                  /*
 1108                   * Does the parent directory of that directory 
 1109                   * exist?  %APPDATA% may not exist even though 
 1110                   * %USERPROFILE% does.
 1111                   *
 1112                   * We check for the existence of the directory
 1113                   * by first checking whether the parent directory 
 1114                   * is just a drive letter and, if it's not, by 
 1115                   * doing a "stat()" on it.  If it's a drive letter,
 1116
1125
Show [ Lines 1116 to 1125 omitted. ]
 1126                           */
 1127                          ret = ws_mkdir(pf_dir_parent_path, 0755);
 1128                          if (ret == -1) {
 1129                                  *pf_dir_path_return = pf_dir_parent_path;
 1130                                  return -1;
 1131                          }
 1132                  }
 1133                  g_free(pf_dir_path_copy);
 1134                  ret = ws_mkdir(pf_dir_path, 0755);
 1135  #else
 1136                  ret = ws_mkdir(pf_dir_path, 0755);
Show more  




Change Warning 3512.30261 : File System Race Condition

Because they are very similar, this warning shares annotations with warning 3512.30262.

Priority:
State:
Finding:
Owner:
Note: