summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchleun.moon <chleun.moon@samsung.com>2017-06-01 11:10:40 +0900
committerchleun.moon <chleun.moon@samsung.com>2017-06-01 11:14:59 +0900
commit6d0c59f3bfb3b4ef7881f925097dae1f75ea9990 (patch)
treeaf2cfdd0eacf97d2f26b784d9b2911f7baaca8db
parent6eab13e3a722e2e155401018e3740d3f96235a24 (diff)
downloadconnman-6d0c59f3bfb3b4ef7881f925097dae1f75ea9990.tar.gz
connman-6d0c59f3bfb3b4ef7881f925097dae1f75ea9990.tar.bz2
connman-6d0c59f3bfb3b4ef7881f925097dae1f75ea9990.zip
Add NULL check before reference
Change-Id: I0485f5c69a2a1699f922b4c2c130f6865f8b31d9 Signed-off-by: cheoleun <chleun.moon@samsung.com>
-rw-r--r--vpn/plugins/ipsec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/vpn/plugins/ipsec.c b/vpn/plugins/ipsec.c
index b1a7ecd2..b5205f7e 100644
--- a/vpn/plugins/ipsec.c
+++ b/vpn/plugins/ipsec.c
@@ -248,6 +248,11 @@ static void read_der_file(const char *path, X509 **cert)
DBG("der path %s\n", path);
fp = fopen(path, "r");
+ if (!fp) {
+ connman_error("fopen %s is failed\n", path);
+ return;
+ }
+
*cert = d2i_X509_fp(fp, NULL);
fclose(fp);
return;
@@ -259,6 +264,11 @@ static void read_pem_file(const char *path, X509 **cert)
DBG("pem path %s\n", path);
fp = fopen(path, "r");
+ if (!fp) {
+ connman_error("fopen %s is failed\n", path);
+ return;
+ }
+
*cert = PEM_read_X509(fp, cert, NULL, NULL);
fclose(fp);
return;