summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchleun.moon <chleun.moon@samsung.com>2017-10-19 19:38:09 +0900
committerchleun.moon <chleun.moon@samsung.com>2017-10-19 19:38:13 +0900
commit9216c9c3a516bf42c6f2fdaf9f5836d5e2e8107b (patch)
tree849a91bad7b7dc1e55912f9ecad5e02057d827dc
parent7ee4af56293d758134c3102551de13b44b3730e5 (diff)
downloadconnman-9216c9c3a516bf42c6f2fdaf9f5836d5e2e8107b.tar.gz
connman-9216c9c3a516bf42c6f2fdaf9f5836d5e2e8107b.tar.bz2
connman-9216c9c3a516bf42c6f2fdaf9f5836d5e2e8107b.zip
Change-Id: I561f537c292f24af2e9956a7694e3868ee0ccd32 Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
-rw-r--r--vpn/plugins/ipsec.c7
-rw-r--r--vpn/plugins/vici-client.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/vpn/plugins/ipsec.c b/vpn/plugins/ipsec.c
index 617830cf..cbc6cb6a 100644
--- a/vpn/plugins/ipsec.c
+++ b/vpn/plugins/ipsec.c
@@ -802,7 +802,12 @@ static char *load_file_from_path(const char *path)
return NULL;
}
- fstat(fd, &st);
+ if (fstat(fd, &st) != 0) {
+ connman_error("fstat failed");
+ fclose(fp);
+ return NULL;
+ }
+
file_size = st.st_size;
file_buff = g_try_malloc0(sizeof(char)*st.st_size);
if (file_buff == NULL) {
diff --git a/vpn/plugins/vici-client.c b/vpn/plugins/vici-client.c
index 5fcc3c52..67e365a5 100644
--- a/vpn/plugins/vici-client.c
+++ b/vpn/plugins/vici-client.c
@@ -286,7 +286,12 @@ static char *load_cert_from_path(const char *path)
return NULL;
}
- fstat(fd, &st);
+ if (fstat(fd, &st) != 0) {
+ connman_error("fstat failed");
+ fclose(fp);
+ return NULL;
+ }
+
file_size = st.st_size;
file_buff = g_try_malloc0(sizeof(char)*st.st_size);
if (file_buff == NULL) {