[rtmpdump] branch master updated. 1c77ff4 Calculate tcUrl length

gitolite gil at avcodec.org
Tue Nov 8 11:13:47 CET 2011


The branch, master has been updated
       via  1c77ff43439068981d2ad9872952922a1ee37f89 (commit)
      from  9df7959a71ec33cc9c83c9d3ef25c17b1c527f0e (commit)


- Log -----------------------------------------------------------------
commit 1c77ff43439068981d2ad9872952922a1ee37f89
Author:     Howard Chu <hyc at highlandsun.com>
AuthorDate: Tue Nov 8 02:13:14 2011 -0800
Commit:     Howard Chu <hyc at highlandsun.com>
CommitDate: Tue Nov 8 02:13:14 2011 -0800

    Calculate tcUrl length

diff --git a/rtmpdump.c b/rtmpdump.c
index a8fa128..892a8bc 100644
--- a/rtmpdump.c
+++ b/rtmpdump.c
@@ -1152,13 +1152,12 @@ main(int argc, char **argv)
 
   if (tcUrl.av_len == 0)
     {
-      char str[1024];
-
-      tcUrl.av_len = snprintf(str, sizeof(str), "%s://%.*s:%d/%.*s",
+	  tcUrl.av_len = strlen(RTMPProtocolStringsLower[protocol]) +
+	  	hostname.av_len + app.av_len + sizeof("://:65535/");
+      tcUrl.av_val = (char *) malloc(tcUrl.av_len);
+      tcUrl.av_len = snprintf(tcUrl.av_val, tcUrl.av_len, "%s://%.*s:%d/%.*s",
 	  	   RTMPProtocolStringsLower[protocol], hostname.av_len,
 		   hostname.av_val, port, app.av_len, app.av_val);
-      tcUrl.av_val = (char *) malloc(tcUrl.av_len + 1);
-      strcpy(tcUrl.av_val, str);
     }
 
   int first = 1;

-----------------------------------------------------------------------

Summary of changes:
 rtmpdump.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)


hooks/post-receive
-- 



More information about the rtmpdump mailing list