[rtmpdump] [PATCH 1/4] Add null termination to buffers before using strstr
Martin Storsjo
martin at martin.st
Mon May 21 17:17:29 CEST 2012
---
librtmp/rtmp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
index 52d0254..d667fb4 100644
--- a/librtmp/rtmp.c
+++ b/librtmp/rtmp.c
@@ -3558,7 +3558,7 @@ RTMPSockBuf_Fill(RTMPSockBuf *sb)
while (1)
{
- nBytes = sizeof(sb->sb_buf) - sb->sb_size - (sb->sb_start - sb->sb_buf);
+ nBytes = sizeof(sb->sb_buf) - 1 - sb->sb_size - (sb->sb_start - sb->sb_buf);
#if defined(CRYPTO) && !defined(NO_SSL)
if (sb->sb_ssl)
{
@@ -3737,6 +3737,7 @@ HTTP_read(RTMP *r, int fill)
return -2;
if (strncmp(r->m_sb.sb_start, "HTTP/1.1 200 ", 13))
return -1;
+ r->m_sb.sb_start[r->m_sb.sb_size] = '\0';
ptr = r->m_sb.sb_start + sizeof("HTTP/1.1 200");
while ((ptr = strstr(ptr, "Content-"))) {
if (!strncasecmp(ptr+8, "length:", 7)) break;
--
1.7.9.4
More information about the rtmpdump
mailing list