[FFmpeg-cvslog] ftp: fix using uninitialized value

Lukasz Marek git at videolan.org
Tue Jun 4 14:01:18 CEST 2013


ffmpeg | branch: master | Lukasz Marek <lukasz.m.luki at gmail.com> | Tue Jun  4 13:03:13 2013 +0200| [7faafe606fb25e3c8b3091ea0565b01622c87dd2] | committer: Lukasz Marek

ftp: fix using uninitialized value

Fix coverity issue CID 1026777

Signed-off-by: Lukasz Marek <lukasz.m.luki at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7faafe606fb25e3c8b3091ea0565b01622c87dd2
---

 libavformat/ftp.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index cd3006b..faa82dd 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -265,7 +265,7 @@ static int ftp_auth(FTPContext *s)
 
 static int ftp_passive_mode(FTPContext *s)
 {
-    char *res = NULL, *start, *end;
+    char *res = NULL, *start = NULL, *end = NULL;
     int i;
     const char *command = "PASV\r\n";
     const int pasv_codes[] = {227, 501, 0}; /* 501 is incorrect code */
@@ -273,8 +273,7 @@ static int ftp_passive_mode(FTPContext *s)
     if (ftp_send_command(s, command, pasv_codes, &res) != 227 || !res)
         goto fail;
 
-    start = NULL;
-    for (i = 0; i < strlen(res); ++i) {
+    for (i = 0; res[i]; ++i) {
         if (res[i] == '(') {
             start = res + i + 1;
         } else if (res[i] == ')') {



More information about the ffmpeg-cvslog mailing list