[vlc-devel] commit: Added a few malloc/strdup checks in ftp. (Laurent Aimar )

git version control git at videolan.org
Tue Sep 9 22:35:40 CEST 2008


vlc | branch: 0.9-bugfix | Laurent Aimar <fenrir at videolan.org> | Tue Sep  9 22:37:32 2008 +0200| [881fc755c6297e26acb5a4033b110a2990aa64ee] | committer: Laurent Aimar 

Added a few malloc/strdup checks in ftp.
(cherry picked from commit 241da007fd1e25cdfb43db0816ddfa85d482a69a)

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

 modules/access/ftp.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/modules/access/ftp.c b/modules/access/ftp.c
index 0b2a410..75878f4 100644
--- a/modules/access/ftp.c
+++ b/modules/access/ftp.c
@@ -153,6 +153,8 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
         psz = strdup( p_sys->url.psz_username );
     else
         psz = var_CreateGetString( p_access, "ftp-user" );
+    if( !psz )
+        return -1;
 
     if( ftp_SendCommand( p_access, p_sys, "USER %s", psz ) < 0 ||
         ftp_ReadCommand( p_access, p_sys, &i_answer, NULL ) < 0 )
@@ -173,6 +175,8 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
                 psz = strdup( p_sys->url.psz_password );
             else
                 psz = var_CreateGetString( p_access, "ftp-pwd" );
+            if( !psz )
+                return -1;
 
             if( ftp_SendCommand( p_access, p_sys, "PASS %s", psz ) < 0 ||
                 ftp_ReadCommand( p_access, p_sys, &i_answer, NULL ) < 0 )




More information about the vlc-devel mailing list