[libdvdcss-devel] css: Check the return value of a malloc() invocation
[email protected] (Diego Biurrun)
| Newsgroups | gmane.comp.video.videolan.libdvdcss,gmane.comp.video.videolan.libdvdcss.devel |
|---|---|
| Message-ID | <[email protected]> |
libdvdcss | branch: master | Diego Biurrun <[email protected]> | 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 ); _______________________________________________ libdvdcss-devel mailing list [email protected] https://mailman.videolan.org/listinfo/libdvdcss-devel