]> git.sesse.net Git - vlc/blobdiff - modules/access/rtmp/rtmp_amf_flv.c
Replaced a %d with PRId64 in dvb access.
[vlc] / modules / access / rtmp / rtmp_amf_flv.c
index bf2b83b7f0a63cf3c6cd5f92006e16d02e572ffc..a639221c4560380f1b5249864548c3d4ebff0e48 100644 (file)
@@ -391,7 +391,7 @@ write_rtmp( rtmp_control_thread_t *p_thread, uint8_t *buf,
     free( buf );
     if( ret != enclen )
     {
-        msg_Err( p_thread, errmsg );
+        msg_Err( p_thread, "%s", errmsg );
         return 0;
     }
     return 1;
@@ -741,7 +741,7 @@ rtmp_build_bytes_read( rtmp_control_thread_t *p_thread, uint32_t reply )
     /* Build bytes read packet */
     rtmp_body = rtmp_body_new( -1 );
 
-    tmp_buffer = (uint8_t *) malloc( sizeof( uint32_t ) * sizeof( uint8_t ) );
+    tmp_buffer = (uint8_t *) malloc( sizeof( uint32_t ) );
     if( !tmp_buffer ) return NULL;
 
     reply = hton32( reply );
@@ -878,6 +878,7 @@ rtmp_build_flv_over_rtmp( rtmp_control_thread_t *p_thread, block_t *p_buffer )
     return rtmp_packet;
 }
 
+/* This function must be cancellation-safe! */
 rtmp_packet_t *
 rtmp_read_net_packet( rtmp_control_thread_t *p_thread )
 {
@@ -1063,6 +1064,11 @@ rtmp_handler_invoke( rtmp_control_thread_t *p_thread, rtmp_packet_t *rtmp_packet
 
     i++; /* Pass over AMF_DATATYPE_STRING */
     string = amf_decode_string( &i );
+    if( !string )
+    {
+        msg_Err(p_thread,"Seriously broken stream");
+        return;
+    }
 
     i++; /* Pass over AMF_DATATYPE_NUMBER */
     number = amf_decode_number( &i );
@@ -1288,8 +1294,6 @@ rtmp_handler_invoke( rtmp_control_thread_t *p_thread, rtmp_packet_t *rtmp_packet
                         }
                         else if( strcmp( "NetConnection.Connect.InvalidApp", string2 ) == 0 )
                         {
-                            p_thread->b_die = 1; 
-
                             vlc_mutex_lock( &p_thread->lock );
                             vlc_cond_signal( &p_thread->wait );
                             vlc_mutex_unlock( &p_thread->lock );
@@ -2192,6 +2196,10 @@ amf_decode_string( uint8_t **buffer )
     length = ntoh16( *(uint16_t *) *buffer );
     *buffer += sizeof( uint16_t );
 
+#error This size is wrong and breaks just about everything.
+    if( length > sizeof( *buffer ) / sizeof( uint8_t ))
+        return NULL;
+
     out = (char *) malloc( length + 1 ); /* '\0' terminated */
     if( !out ) return NULL;