[vlc-devel] commit: Fixed read(NULL, size) in zipstream. (Laurent Aimar )

git version control git at videolan.org
Sun Feb 28 00:27:38 CET 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Feb 27 22:09:09 2010 +0100| [08813ee6f8eb0faf83790bd4247c0a97af75a1cf] | committer: Laurent Aimar 

Fixed read(NULL, size) in zipstream.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=08813ee6f8eb0faf83790bd4247c0a97af75a1cf
---

 modules/access/zip/zipstream.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/modules/access/zip/zipstream.c b/modules/access/zip/zipstream.c
index 0ccaa86..abe7ba8 100644
--- a/modules/access/zip/zipstream.c
+++ b/modules/access/zip/zipstream.c
@@ -253,15 +253,14 @@ static int Read( stream_t *s, void *p_read, unsigned int i_read )
 {
     stream_sys_t *p_sys = s->p_sys;
 
-    if( !p_read ) return 0;
-
     /* Fill the buffer */
     if( Fill( s ) )
         return -1;
 
     /* Read the buffer */
-    int i_len = __MIN( i_read, p_sys->i_len - p_sys->i_pos );
-    memcpy( p_read, p_sys->psz_xspf + p_sys->i_pos, i_len );
+    unsigned i_len = __MIN( i_read, p_sys->i_len - p_sys->i_pos );
+    if( p_read )
+        memcpy( p_read, p_sys->psz_xspf + p_sys->i_pos, i_len );
     p_sys->i_pos += i_len;
 
     return i_len;




More information about the vlc-devel mailing list