Validate filesystem UUIDs in Binder calls.
Test: boots
Bug: 67041047
Change-Id: I7bb21186db8cd709a9adfc5f9d0dedb069b2cff3
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index 6fb1731..a900ba1 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -695,20 +695,22 @@
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));
}