summaryrefslogtreecommitdiff
path: root/src/libstrongswan/utils/optionsfrom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/utils/optionsfrom.c')
-rw-r--r--src/libstrongswan/utils/optionsfrom.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libstrongswan/utils/optionsfrom.c b/src/libstrongswan/utils/optionsfrom.c
index 117071351..6f721c9ef 100644
--- a/src/libstrongswan/utils/optionsfrom.c
+++ b/src/libstrongswan/utils/optionsfrom.c
@@ -90,8 +90,13 @@ METHOD(options_t, from, bool,
}
/* determine the file size */
- fseek(fd, 0, SEEK_END);
- src.len = ftell(fd);
+ if (fseek(fd, 0, SEEK_END) == -1 || (src.len = ftell(fd)) == -1)
+ {
+ DBG1(DBG_LIB, "optionsfrom: unable to determine size of '%s': %s",
+ filename, strerror(errno));
+ fclose(fd);
+ return FALSE;
+ }
rewind(fd);
/* allocate one byte more just in case of a missing final newline */