[libbluray-devel] Check for null

hpi1 git at videolan.org
Fri Jun 12 11:36:34 CEST 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Jun 11 11:54:56 2015 +0300| [0eca783f6accafc82d3113812458fd022ddfa56d] | committer: hpi1

Check for null

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=0eca783f6accafc82d3113812458fd022ddfa56d
---

 src/file/file.c         |    4 ++++
 src/libbluray/bdj/bdj.c |    8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/file/file.c b/src/file/file.c
index 15edfe0..2f85248 100644
--- a/src/file/file.c
+++ b/src/file/file.c
@@ -52,6 +52,10 @@ int file_mkdirs(const char *path)
     char *end = dir;
     char *p;
 
+    if (!dir) {
+        return -1;
+    }
+
     /* strip file name */
     if (!(end = strrchr(end, DIR_SEP_CHAR))) {
         X_FREE(dir);
diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index 6747972..4604adc 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -212,7 +212,13 @@ static void *_load_jvm(const char **p_java_home)
 
 static int _can_read_file(const char *fn)
 {
-    FILE *fp = fopen(fn, "rb");
+    FILE *fp;
+
+    if (!fn) {
+        return 0;
+    }
+
+    fp = fopen(fn, "rb");
     if (fp) {
         char b;
         int result = (int)fread(&b, 1, 1, fp);



More information about the libbluray-devel mailing list