summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaesub kim <taesub.kim@samsung.com>2017-10-10 08:36:03 +0000
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>2017-10-10 08:36:03 +0000
commit9c187eea4fec7708994824d79daa60f7728bdd52 (patch)
treef2fbf21e724f14aa7f76146eed71be837fcfe648
parent1ea39c8b20fa43a70eea94ded49688c4f25fe607 (diff)
parente083f03f021a57f68d0d0065dce19316248bacbf (diff)
downloadconnman-9c187eea4fec7708994824d79daa60f7728bdd52.tar.gz
connman-9c187eea4fec7708994824d79daa60f7728bdd52.tar.bz2
connman-9c187eea4fec7708994824d79daa60f7728bdd52.zip
Merge "[CID-32919, 33501] Fix bug" into tizen_4.0
-rw-r--r--vpn/plugins/ipsec.c6
-rw-r--r--vpn/plugins/vici-client.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/vpn/plugins/ipsec.c b/vpn/plugins/ipsec.c
index fa9dc7af..617830cf 100644
--- a/vpn/plugins/ipsec.c
+++ b/vpn/plugins/ipsec.c
@@ -796,6 +796,12 @@ static char *load_file_from_path(const char *path)
}
fd = fileno(fp);
+ if (fd == -1) {
+ connman_error("fp is not a valid stream");
+ fclose(fp);
+ return NULL;
+ }
+
fstat(fd, &st);
file_size = st.st_size;
file_buff = g_try_malloc0(sizeof(char)*st.st_size);
diff --git a/vpn/plugins/vici-client.c b/vpn/plugins/vici-client.c
index dc651cfd..94228945 100644
--- a/vpn/plugins/vici-client.c
+++ b/vpn/plugins/vici-client.c
@@ -280,6 +280,12 @@ static char *load_cert_from_path(const char *path)
}
fd = fileno(fp);
+ if (fd == -1) {
+ connman_error("fp is not a valid stream");
+ fclose(fp);
+ return NULL;
+ }
+
fstat(fd, &st);
file_size = st.st_size;
file_buff = g_try_malloc0(sizeof(char)*st.st_size);