Update zm_rtsp.cpp

--- ZoneMinder-master/src/zm_rtsp.cpp	Wed Sep 18 06:00:06 2013 UTC
+++ ZoneMinder-master.rtsp/src/zm_rtsp.cpp	Tue Sep 24 11:56:11 2013 UTC
@@ -576,13 +576,15 @@
                 {
                     if ( buffer[0] == '$' )
                     {
+                	if ( buffer.size() < 4 )
+                	    break;
                         unsigned char channel = buffer[1];
                         unsigned short len = ntohs( *((unsigned short *)(buffer+2)) );
 
                         Debug( 4, "Got %d bytes left, expecting %d byte packet on channel %d", buffer.size(), len, channel );
                         if ( (unsigned short)buffer.size() < (len+4) )
                         {
-                            Debug( 4, "Missing %zd bytes, rereading", (len+4)-nBytes );
+                            Debug( 4, "Missing %d bytes, rereading", (len+4)-buffer.size() );
                             break;
                         }
                         if ( channel == remoteChannels[0] )
@@ -594,8 +596,10 @@
                         }
                         else if ( channel == remoteChannels[1] )
                         {
-                            len = ntohs( *((unsigned short *)(buffer+2)) );
-                            Debug( 4, "Got %zd bytes on control channel %d", nBytes, channel );
+//                            len = ntohs( *((unsigned short *)(buffer+2)) );
+//                            Debug( 4, "Got %d bytes on control channel %d", nBytes, channel );
+                            Debug( 4, "Got %d bytes on control channel %d, packet length is %d", buffer.size(), channel, len );
+                            Hexdump( 4, (char *)buffer, 16 );
                             rtpCtrlThread.recvPackets( buffer+4, len );
                         }
                         else