[libdvdcss-devel] css: Check the return value of a malloc() invocation

Diego Biurrun git at videolan.org
Thu Oct 30 17:16:34 CET 2014


libdvdcss | branch: master | Diego Biurrun <diego at biurrun.de> | Tue Oct 28 12:34:41 2014 +0100| [845744d39c7f95df3b5b8343ced219e8d5d6590f] | committer: Diego Biurrun

css: Check the return value of a malloc() invocation

This prevents a possible NULL pointer dereference further along.

> http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=845744d39c7f95df3b5b8343ced219e8d5d6590f
---

 src/css.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/css.c b/src/css.c
index c5441f1..64a89c5 100644
--- a/src/css.c
+++ b/src/css.c
@@ -297,6 +297,10 @@ int dvdcss_title ( dvdcss_t dvdcss, int i_block )
 
     /* Write in the new title and its key */
     p_newtitle = malloc( sizeof( dvd_title_t ) );
+    if( p_newtitle == NULL )
+    {
+        return -1;
+    }
     p_newtitle->i_startlb = i_block;
     memcpy( p_newtitle->p_key, p_title_key, KEY_SIZE );
 



More information about the libdvdcss-devel mailing list