Skip to content

Commit a2201c1

Browse files
committed
Use blocked paths in textfilecontent probe
1 parent aa9ffd0 commit a2201c1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/OVAL/probes/independent/textfilecontent_probe.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ struct pfdata {
136136
probe_ctx *ctx;
137137
};
138138

139-
static int process_file(const char *prefix, const char *path, const char *filename, void *arg, oval_schema_version_t over)
139+
static int process_file(const char *prefix, const char *path, const char *filename, void *arg, oval_schema_version_t over, struct oscap_list *blocked_paths)
140140
{
141141
struct pfdata *pfd = (struct pfdata *) arg;
142142
int ret = 0, path_len, filename_len;
@@ -170,6 +170,10 @@ static int process_file(const char *prefix, const char *path, const char *filena
170170
}
171171
memcpy(whole_path + path_len, filename, filename_len + 1);
172172

173+
if (probe_path_is_blocked(whole_path, blocked_paths)) {
174+
goto cleanup;
175+
}
176+
173177
/*
174178
* If stat() fails, don't report an error and just skip the file.
175179
* This is an expected situation, because the fts_*() functions
@@ -294,7 +298,7 @@ int textfilecontent_probe_main(probe_ctx *ctx, void *arg)
294298
if (ofts_ent->fts_info == FTS_F
295299
|| ofts_ent->fts_info == FTS_SL) {
296300
// todo: handle return code
297-
process_file(prefix, ofts_ent->path, ofts_ent->file, &pfd, over);
301+
process_file(prefix, ofts_ent->path, ofts_ent->file, &pfd, over, ctx->blocked_paths);
298302
}
299303
oval_ftsent_free(ofts_ent);
300304
}

0 commit comments

Comments
 (0)