Data URIs: don't decodewith invalid length..
This commit is contained in:
parent
89b4e98a8f
commit
781c9f2a8f
@ -89,6 +89,12 @@ BDataRequest::_ProtocolLoop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isBase64) {
|
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];
|
char* buffer = new char[data.Length() * 3 / 4];
|
||||||
payload = buffer;
|
payload = buffer;
|
||||||
// payload must be a const char* so we can assign data.String() to
|
// payload must be a const char* so we can assign data.String() to
|
||||||
|
Loading…
Reference in New Issue
Block a user