Author: spyfeng
Date: Mon Apr 19 18:05:23 2010
New Revision: 5761
Log:
check possible buffer overflow before writting.
Modified:
mms/mmst.c
Modified: mms/mmst.c
==============================================================================
--- mms/mmst.c Mon Apr 19 17:50:24 2010 (r5760)
+++ mms/mmst.c Mon Apr 19 18:05:23 2010 (r5761)
@@ -444,6 +444,11 @@ static int send_stream_selection_request
// send the streams we want back...
start_command_packet(mms, CS_PKT_STREAM_ID_REQUEST);
bytestream_put_le32(&mms->write_ptr, mms->stream_num); // stream
nums
+ if (mms->write_ptr - mms->outgoing_packet_buffer >
+ sizeof(mms->outgoing_packet_buffer) - 6 * mms->stream_num) {
+ dprintf("buffer will overflow for too many streams: %d.\n",
mms->stream_num);
+ return AVERROR_IO;
+ }
for(i= 0; i<mms->stream_num; i++) {
bytestream_put_le16(&mms->write_ptr, 0xffff); // flags
bytestream_put_le16(&mms->write_ptr, mms->streams[i].id); // stream id
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc