mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C++: fix example code for FilePermissions.qll
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
int write_default_config_bad() {
|
||||
void write_default_config_bad() {
|
||||
// BAD - this is world-writable so any user can overwrite the config
|
||||
FILE* out = creat(OUTFILE, 0666);
|
||||
fprintf(out, DEFAULT_CONFIG);
|
||||
int out = creat(OUTFILE, 0666);
|
||||
dprintf(out, DEFAULT_CONFIG);
|
||||
}
|
||||
|
||||
int write_default_config_good() {
|
||||
void write_default_config_good() {
|
||||
// GOOD - this allows only the current user to modify the file
|
||||
FILE* out = creat(OUTFILE, S_IWUSR | S_IRUSR);
|
||||
fprintf(out, DEFAULT_CONFIG);
|
||||
int out = creat(OUTFILE, S_IWUSR | S_IRUSR);
|
||||
dprintf(out, DEFAULT_CONFIG);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user