[rtmpdump] add packet size check in ServeInvoke() for rtmpsuck

fcicq fcicq at fcicq.net
Mon Jan 11 18:20:03 CET 2016


Without the nBodySize check, the later (body[0] != 0x02) check will trigger a null pointer deference and cause a crash.
This kind of empty packet may have some relationship with NetStream.Video.DimensionChange event.

diff --git a/rtmpsuck.c b/rtmpsuck.c
index e886179..633a1f3 100644
--- a/rtmpsuck.c
+++ b/rtmpsuck.c
@@ -160,6 +160,12 @@ ServeInvoke(STREAMING_SERVER *server, int which, RTMPPacket *pack, const char *b
   int ret = 0, nRes;
   int nBodySize = pack->m_nBodySize;
 
+  if (!nBodySize)
+    {
+      RTMP_Log(RTMP_LOGERROR, "%s, empty packet from %s", __FUNCTION__, cst[which]);
+      return 0;
+    }
+
   if (body > pack->m_body)
     nBodySize--;
 



More information about the rtmpdump mailing list