Skip to content

Commit e4ea549

Browse files
committed
Use blocked paths in xmlfilecontent probe
1 parent 551f972 commit e4ea549

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/OVAL/probes/independent/xmlfilecontent_probe.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static xmlDocPtr strip_ns(xmlDocPtr doc)
142142
return result;
143143
}
144144

145-
static int process_file(const char *prefix, const char *path, const char *filename, struct pfdata *pfd)
145+
static int process_file(const char *prefix, const char *path, const char *filename, struct pfdata *pfd, struct oscap_list *blocked_paths)
146146
{
147147
int ret = 0, path_len, filename_len;
148148
char *whole_path = NULL;
@@ -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
if (prefix == NULL) {
174178
doc = xmlParseFile(whole_path);
175179
} else {
@@ -392,7 +396,7 @@ int xmlfilecontent_probe_main(probe_ctx *ctx, void *arg)
392396

393397
if ((ofts = oval_fts_open_prefixed(prefix, path_ent, filename_ent, filepath_ent, behaviors_ent, probe_ctx_getresult(ctx))) != NULL) {
394398
while ((ofts_ent = oval_fts_read(ofts)) != NULL) {
395-
process_file(prefix, ofts_ent->path, ofts_ent->file, &pfd);
399+
process_file(prefix, ofts_ent->path, ofts_ent->file, &pfd, ctx->blocked_paths);
396400
oval_ftsent_free(ofts_ent);
397401
}
398402

0 commit comments

Comments
 (0)