A crash could be provoked e.g. via STRONGSWAN_CONF=. or any other
path to a directory.
#include <limits.h>
#include <ctype.h>
#include <stdarg.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include "parser_helper.h"
private_parser_helper_t *this)
{
parser_helper_file_t *file, *next;
+ struct stat st;
char *name;
array_get(this->files, ARRAY_TAIL, &file);
.file = fopen(name, "r"),
);
- if (next->file)
+ if (next->file && fstat(fileno(next->file), &st) == 0 &&
+ S_ISREG(st.st_mode))
{
array_insert(this->files, ARRAY_TAIL, next);
return next->file;