[libbluray-devel] Check for NULL

Petri Hintukainen git at videolan.org
Thu Feb 19 19:38:34 CET 2015


libudfread | branch: master | Petri Hintukainen <phintuka at gmail.com> | Thu Feb 19 20:38:22 2015 +0200| [f73b9e1ebbf940814cc118c2e9f258e372088595] | committer: Petri Hintukainen

Check for NULL

> http://git.videolan.org/gitweb.cgi/libudfread.git/?a=commit;h=f73b9e1ebbf940814cc118c2e9f258e372088595
---

 src/udfread.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/udfread.c b/src/udfread.c
index 8548a50..12ffa8a 100644
--- a/src/udfread.c
+++ b/src/udfread.c
@@ -1196,6 +1196,10 @@ UDFDIR *udfread_opendir(udfread *udf, const char *path)
         return NULL;
     }
 
+    if (!dir) {
+        return NULL;
+    }
+
     result = (UDFDIR *)calloc(1, sizeof(UDFDIR));
     if (result) {
         result->dir = dir;
@@ -1208,7 +1212,7 @@ struct udfread_dirent *udfread_readdir(UDFDIR *p, struct udfread_dirent *entry)
 {
     const struct udf_file_identifier *fe;
 
-    if (!p || !entry) {
+    if (!p || !entry || !p->dir) {
         return NULL;
     }
 



More information about the libbluray-devel mailing list