Skip to content

CID 1508887: Time of check time of use #10209

@maskit

Description

@maskit
178void
179loadConfigFile(const std::string &fileName, std::stringstream &doc, std::unordered_set<std::string> &include_once)
180{
181  const char *sep = " \t";
182  char *tok, *last;
183  struct stat buf;
184  std::string line;
185
   	
CID 1508887 (#1 of 1): Time of check time of use (TOCTOU)
1. fs_check_call: Calling function stat to perform check on fileName->c_str().
   	2. Condition stat(fileName->c_str(), &buf) == -1, taking false branch.
186  if (stat(fileName.c_str(), &buf) == -1) {
187    std::string err_msg = strerror(errno);
188    throw std::invalid_argument("Unable to stat '" + fileName + "': " + err_msg);
189  }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions