Merge pull request #14996 from jketema/toctou-test

C++: Fix `chmod` prototype in toctou test and additional test
This commit is contained in:
Mathias Vorreiter Pedersen
2023-12-04 17:42:52 +00:00
committed by GitHub

View File

@@ -19,7 +19,7 @@ bool stat(const char *path, stat_data *buf);
bool fstat(int file, stat_data *buf);
bool lstat(const char *path, stat_data *buf);
bool fstatat(int dir, const char *path, stat_data *buf);
void chmod(const char *path, int setting);
int chmod(const char *path, int setting);
int rename(const char *from, const char *to);
bool remove(const char *path);
@@ -408,3 +408,8 @@ void test7_1(const char *path1, const char *path2)
chmod(path2, 1234); // BAD
}
}
int test8(const char *path, int mode)
{
return (chmod(path, mode) == 0 ? 1 : 0); // GOOD
}