[matroska] r825 - trunk/DvdMenuXtractor

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2004-09-18 17:41:50 +0400 (Sat, 18 Sep 2004)
New Revision: 825

Modified:
   trunk/DvdMenuXtractor/base64.cpp
Log:
fix a buffer "overread"

Modified: trunk/DvdMenuXtractor/base64.cpp
===================================================================
--- trunk/DvdMenuXtractor/base64.cpp	2004-09-18 13:15:11 UTC (rev 824)
+++ trunk/DvdMenuXtractor/base64.cpp	2004-09-18 13:41:50 UTC (rev 825)
@@ -29,17 +29,31 @@
 {
 	wxString result = "";
 	unsigned char _out[5];
+	unsigned char _in[3];
 	unsigned int _len;
 	_out[4] = 0;
 
-    while (size)
+    while (size >= 3)
 	{
-		_len = (size < 3)?size:3;
-		encodeblock(buffer, _out, _len);
-		size -= _len;
-		buffer += _len;
+		encodeblock(buffer, _out, 3);
+		size -= 3;
+		buffer += 3;
 		result += _out;
 	}
+	if (size)
+	{
+		_len = 0;
+		_in[0] = 0;
+		_in[1] = 0;
+		_in[2] = 0;
+		while (size--)
+		{
+			_in[_len] = buffer[_len];
+			_len++;
+		}
+		encodeblock(_in, _out, _len);
+		result += _out;
+	}
 
 	return result;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.