summaryrefslogtreecommitdiff
path: root/src/libstrongswan/utils/optionsfrom.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@corsac.net>2012-06-28 21:16:07 +0200
committerYves-Alexis Perez <corsac@corsac.net>2012-06-28 21:16:07 +0200
commitb34738ed08c2227300d554b139e2495ca5da97d6 (patch)
tree62f33b52820f2e49f0e53c0f8c636312037c8054 /src/libstrongswan/utils/optionsfrom.c
parent0a9d51a49042a68daa15b0c74a2b7f152f52606b (diff)
downloadvyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.tar.gz
vyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.zip
Imported Upstream version 4.6.4
Diffstat (limited to 'src/libstrongswan/utils/optionsfrom.c')
-rw-r--r--src/libstrongswan/utils/optionsfrom.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libstrongswan/utils/optionsfrom.c b/src/libstrongswan/utils/optionsfrom.c
index e51780290..5fd4cfd4d 100644
--- a/src/libstrongswan/utils/optionsfrom.c
+++ b/src/libstrongswan/utils/optionsfrom.c
@@ -67,7 +67,6 @@ METHOD(options_t, from, bool,
int newargc;
int next; /* place for next argument */
char **newargv;
- size_t bytes;
chunk_t src, line, token;
bool good = TRUE;
int linepos = 0;
@@ -99,7 +98,14 @@ METHOD(options_t, from, bool,
src.ptr = this->buffers[this->nuses] = malloc(src.len + 1);
/* read the whole file into a chunk */
- bytes = fread(src.ptr, 1, src.len, fd);
+ if (fread(src.ptr, 1, src.len, fd) != src.len)
+ {
+ DBG1(DBG_LIB, "optionsfrom: unable to read file '%s': %s",
+ filename, strerror(errno));
+ free(src.ptr);
+ fclose(fd);
+ return FALSE;
+ }
fclose(fd);
if (this->room)