[vlc-commits] Revert "access: ftp: fix potential invalid write."

Jean-Baptiste Kempf git at videolan.org
Sat Dec 6 18:20:09 CET 2014


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Dec  6 18:18:34 2014 +0100| [b09fe55deaf055d433ebf34096d0d22d6eb4df41] | committer: Jean-Baptiste Kempf

Revert "access: ftp: fix potential invalid write."

This reverts commit 11d4770c6616fcb36cf014f4759679ac66ff7540.

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

 modules/access/ftp.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/modules/access/ftp.c b/modules/access/ftp.c
index a6b586e..5224e7e 100644
--- a/modules/access/ftp.c
+++ b/modules/access/ftp.c
@@ -151,13 +151,7 @@ static int ftp_SendCommand( vlc_object_t *obj, access_sys_t *sys,
                             const char *fmt, ... )
 {
     size_t fmtlen = strlen( fmt );
-
-    if( fmtlen > SIZE_MAX - 3 )
-        return -1;
-
-    char *fmtbuf = malloc( fmtlen + 3 );
-    if( !fmtbuf )
-        return -1;
+    char fmtbuf[fmtlen + 3];
 
     memcpy( fmtbuf, fmt, fmtlen );
     memcpy( fmtbuf + fmtlen, "\r\n", 3 );
@@ -169,7 +163,6 @@ static int ftp_SendCommand( vlc_object_t *obj, access_sys_t *sys,
     va_start( args, fmt );
     val = vasprintf( &cmd, fmtbuf, args );
     va_end( args );
-    free(fmtbuf);
     if( unlikely(val == -1) )
         return -1;
 



More information about the vlc-commits mailing list