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

git at videolan.org git at videolan.org
Thu Apr 15 18:54:42 CEST 2010


vlc/vlc-1.0 | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Feb 27 22:09:09 2010 +0100| [2aa30d4a8f522c579c413937595cfca7a0e2a009] | committer: Rémi Denis-Courmont 

Fixed read(NULL, size) in zipstream.

(cherry picked from commit 08813ee6f8eb0faf83790bd4247c0a97af75a1cf)
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.0.git/?a=commit;h=2aa30d4a8f522c579c413937595cfca7a0e2a009
---

 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 70e1084..f4b9ed3 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-commits mailing list