mirror of
https://github.com/mpv-player/mpv
synced 2024-12-24 15:52:25 +00:00
fix a problem pointed out by iDEFENSE and several similar ones.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14164 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
a891b78290
commit
343d83d5a6
@ -42,6 +42,7 @@
|
|||||||
#include "network.h"
|
#include "network.h"
|
||||||
|
|
||||||
#define BUF_SIZE 102400
|
#define BUF_SIZE 102400
|
||||||
|
#define HDR_BUF_SIZE 8192
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -216,6 +217,11 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl)
|
|||||||
|
|
||||||
// printf ("asf header packet detected, len=%d\n", packet_len);
|
// printf ("asf header packet detected, len=%d\n", packet_len);
|
||||||
|
|
||||||
|
if (packet_len < 0 || packet_len > HDR_BUF_SIZE - header_len) {
|
||||||
|
mp_msg(MSGT_NETWORK, MSGL_FATAL, "Invalid header size, giving up\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!get_data (s, &header[header_len], packet_len)) {
|
if (!get_data (s, &header[header_len], packet_len)) {
|
||||||
printf ("header data read failed\n");
|
printf ("header data read failed\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -250,6 +256,12 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl)
|
|||||||
packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4;
|
packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4;
|
||||||
|
|
||||||
// printf ("command packet detected, len=%d\n", packet_len);
|
// printf ("command packet detected, len=%d\n", packet_len);
|
||||||
|
|
||||||
|
if (packet_len < 0 || packet_len > BUF_SIZE) {
|
||||||
|
mp_msg(MSGT_NETWORK, MSGL_FATAL,
|
||||||
|
"Invalid rtsp packet size, giving up\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!get_data (s, data, packet_len)) {
|
if (!get_data (s, data, packet_len)) {
|
||||||
printf ("command data read failed\n");
|
printf ("command data read failed\n");
|
||||||
@ -361,6 +373,12 @@ static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl)
|
|||||||
|
|
||||||
// printf ("asf media packet detected, len=%d\n", packet_len);
|
// printf ("asf media packet detected, len=%d\n", packet_len);
|
||||||
|
|
||||||
|
if (packet_len < 0 || packet_len > BUF_SIZE) {
|
||||||
|
mp_msg(MSGT_NETWORK, MSGL_FATAL,
|
||||||
|
"Invalid rtsp packet size, giving up\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!get_data (s, data, packet_len)) {
|
if (!get_data (s, data, packet_len)) {
|
||||||
printf ("media data read failed\n");
|
printf ("media data read failed\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -380,6 +398,12 @@ static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl)
|
|||||||
|
|
||||||
packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4;
|
packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4;
|
||||||
|
|
||||||
|
if (packet_len < 0 || packet_len > BUF_SIZE) {
|
||||||
|
mp_msg(MSGT_NETWORK, MSGL_FATAL,
|
||||||
|
"Invalid rtsp packet size, giving up\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!get_data (s, data, packet_len)) {
|
if (!get_data (s, data, packet_len)) {
|
||||||
printf ("command data read failed\n");
|
printf ("command data read failed\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -464,7 +488,7 @@ int asf_mmst_streaming_start(stream_t *stream)
|
|||||||
{
|
{
|
||||||
char str[1024];
|
char str[1024];
|
||||||
char data[BUF_SIZE];
|
char data[BUF_SIZE];
|
||||||
uint8_t asf_header[8192];
|
uint8_t asf_header[HDR_BUF_SIZE];
|
||||||
int asf_header_len;
|
int asf_header_len;
|
||||||
int len, i, packet_length;
|
int len, i, packet_length;
|
||||||
char *path, *unescpath;
|
char *path, *unescpath;
|
||||||
|
Loading…
Reference in New Issue
Block a user