[vlc-commits] Real RTSP: use net_Write() as appropriate

Rémi Denis-Courmont git at videolan.org
Sun Mar 5 14:28:21 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar  5 15:07:55 2017 +0200| [f6c3895ff15c5b9e89ce3b017ac54d103ce16da9] | committer: Rémi Denis-Courmont

Real RTSP: use net_Write() as appropriate

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

 modules/access/rtsp/access.c | 2 +-
 modules/access/rtsp/rtsp.c   | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/modules/access/rtsp/access.c b/modules/access/rtsp/access.c
index 7f63a52..6c284a9 100644
--- a/modules/access/rtsp/access.c
+++ b/modules/access/rtsp/access.c
@@ -133,7 +133,7 @@ static int RtspWrite( void *p_userdata, uint8_t *p_buffer, int i_buffer )
 
     //fprintf(stderr, "Write: %s", p_buffer);
 
-    net_Printf( p_access, p_sys->fd, "%s", p_buffer );
+    net_Write( p_access, p_sys->fd, p_buffer, i_buffer );
 
     return 0;
 }
diff --git a/modules/access/rtsp/rtsp.c b/modules/access/rtsp/rtsp.c
index ceba0e6..e6e4c74 100644
--- a/modules/access/rtsp/rtsp.c
+++ b/modules/access/rtsp/rtsp.c
@@ -111,14 +111,13 @@ static char *rtsp_get( rtsp_client_t *rtsp )
 static int rtsp_put( rtsp_client_t *rtsp, const char *psz_string )
 {
     unsigned int i_buffer = strlen( psz_string );
-    char *psz_buffer = xmalloc( i_buffer + 3 );
+    uint8_t *psz_buffer = xmalloc( i_buffer + 2 );
     int i_ret;
 
-    strcpy( psz_buffer, psz_string );
+    memcpy( psz_buffer, psz_string, i_buffer );
     psz_buffer[i_buffer] = '\r'; psz_buffer[i_buffer+1] = '\n';
-    psz_buffer[i_buffer+2] = 0;
 
-    i_ret = rtsp->pf_write( rtsp->p_userdata, (uint8_t*)psz_buffer, i_buffer + 2 );
+    i_ret = rtsp->pf_write( rtsp->p_userdata, psz_buffer, i_buffer + 2 );
 
     free( psz_buffer );
     return i_ret;



More information about the vlc-commits mailing list