Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23da4855 authored by Elliott Hughes's avatar Elliott Hughes Committed by android-build-merger
Browse files

Merge "Stop writing NUL bytes in adbkey.pub." am: d340c1eb am: 68c9642a am: a404e8ff

am: 5ccb3b97

Change-Id: I103bf495648b4a003677969ff7bbd1aae1f7ad4f
parents e8be8fa3 5ccb3b97
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -82,16 +82,17 @@ static bool write_public_keyfile(RSA* private_key, const std::string& private_ke
        return false;
    }

    size_t base64_key_length;
    if (!EVP_EncodedLength(&base64_key_length, sizeof(binary_key_data))) {
    size_t expected_length;
    if (!EVP_EncodedLength(&expected_length, sizeof(binary_key_data))) {
        LOG(ERROR) << "Public key too large to base64 encode";
        return false;
    }

    std::string content;
    content.resize(base64_key_length);
    base64_key_length = EVP_EncodeBlock(reinterpret_cast<uint8_t*>(&content[0]), binary_key_data,
    content.resize(expected_length);
    size_t actual_length = EVP_EncodeBlock(reinterpret_cast<uint8_t*>(&content[0]), binary_key_data,
                                           sizeof(binary_key_data));
    content.resize(actual_length);

    content += get_user_info();