Data URIs: don't decodewith invalid length..

This commit is contained in:
Adrien Destugues 2014-08-04 16:51:49 +02:00
parent 89b4e98a8f
commit 781c9f2a8f

View File

@ -89,6 +89,12 @@ BDataRequest::_ProtocolLoop()
}
if (isBase64) {
// Check that the base64 data is properly padded (we process characters
// by groups of 4 and there must not be stray chars at the end as
// Base64 specifies padding.
if (data.Length() & 3)
return B_BAD_DATA;
char* buffer = new char[data.Length() * 3 / 4];
payload = buffer;
// payload must be a const char* so we can assign data.String() to