mirror of
https://github.com/darlinghq/darling-dmg.git
synced 2024-11-26 21:20:33 +00:00
Pass input without trailing whitespace to prevent decoder from getting confused
This commit is contained in:
parent
8993ee4744
commit
a08b052b68
@ -207,13 +207,15 @@ bool DMGDisk::base64Decode(const std::string& input, std::vector<uint8_t>& outpu
|
||||
std::unique_ptr<char[]> buffer(new char[input.length()]);
|
||||
int rd;
|
||||
|
||||
auto b64_input = input.substr(0, input.find_last_not_of("\r\t\f\v"));
|
||||
|
||||
b64 = BIO_new(BIO_f_base64());
|
||||
bmem = BIO_new_mem_buf((void*) input.c_str(), input.length());
|
||||
bmem = BIO_new_mem_buf((void*) b64_input.c_str(), b64_input.length());
|
||||
bmem = BIO_push(b64, bmem);
|
||||
//BIO_set_flags(bmem, BIO_FLAGS_BASE64_NO_NL);
|
||||
|
||||
rd = BIO_read(bmem, buffer.get(), input.length());
|
||||
|
||||
|
||||
rd = BIO_read(bmem, buffer.get(), b64_input.length());
|
||||
|
||||
if (rd > 0)
|
||||
output.assign(buffer.get(), buffer.get()+rd);
|
||||
|
||||
@ -266,4 +268,3 @@ std::shared_ptr<Reader> DMGDisk::readerForKolyBlock(int index)
|
||||
return nullptr;
|
||||
return std::shared_ptr<Reader>(new DMGPartition(m_reader, table));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user