Validate filesystem UUIDs in Binder calls.

Test: boots
Bug: 67041047
Change-Id: I7bb21186db8cd709a9adfc5f9d0dedb069b2cff3
This commit is contained in:
Paul Crowley 2017-10-16 10:59:51 -07:00
parent 8e55066845
commit 06f762d577

View file

@ -695,20 +695,22 @@ binder::Status VoldNativeService::lockUserKey(int32_t userId) {
binder::Status VoldNativeService::prepareUserStorage(const std::unique_ptr<std::string>& uuid,
int32_t userId, int32_t userSerial, int32_t flags) {
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_CRYPT_LOCK;
std::string empty_string = "";
auto uuid_ = uuid ? *uuid : empty_string;
CHECK_ARGUMENT_HEX(uuid_);
ACQUIRE_CRYPT_LOCK;
return translateBool(e4crypt_prepare_user_storage(uuid_, userId, userSerial, flags));
}
binder::Status VoldNativeService::destroyUserStorage(const std::unique_ptr<std::string>& uuid,
int32_t userId, int32_t flags) {
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_CRYPT_LOCK;
std::string empty_string = "";
auto uuid_ = uuid ? *uuid : empty_string;
CHECK_ARGUMENT_HEX(uuid_);
ACQUIRE_CRYPT_LOCK;
return translateBool(e4crypt_destroy_user_storage(uuid_, userId, flags));
}