Skip to content

Commit a713612

Browse files
fix: STAA-12 remediation commit iii
1 parent 5aaf7e6 commit a713612

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/core/ModuleManager.sol

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ abstract contract ModuleManager is AllStorage, EIP712, IModuleManager {
219219
revert DefaultValidatorAlreadyInstalled();
220220
}
221221
_getAccountStorage().validators.push(validator);
222-
IValidator(validator).onInstall(data);
222+
if (data.length > 0) {
223+
IValidator(validator).onInstall(data);
224+
}
223225
}
224226

225227
/// @dev Uninstalls a validator module
@@ -266,7 +268,9 @@ abstract contract ModuleManager is AllStorage, EIP712, IModuleManager {
266268
function _installExecutor(address executor, bytes calldata data) internal virtual withHook {
267269
if (!IExecutor(executor).isModuleType(MODULE_TYPE_EXECUTOR)) revert MismatchModuleTypeId();
268270
_getAccountStorage().executors.push(executor);
269-
IExecutor(executor).onInstall(data);
271+
if (data.length > 0) {
272+
IExecutor(executor).onInstall(data);
273+
}
270274
}
271275

272276
/// @dev Uninstalls an executor module by removing it from the executors list.
@@ -310,7 +314,9 @@ abstract contract ModuleManager is AllStorage, EIP712, IModuleManager {
310314
address currentHook = _getHook();
311315
require(currentHook == address(0), HookAlreadyInstalled(currentHook));
312316
_setHook(hook);
313-
IHook(hook).onInstall(data);
317+
if (data.length > 0) {
318+
IHook(hook).onInstall(data);
319+
}
314320
}
315321

316322
/// @dev Uninstalls a hook module, ensuring the current hook matches the one intended for uninstallation.
@@ -477,7 +483,9 @@ abstract contract ModuleManager is AllStorage, EIP712, IModuleManager {
477483

478484
// Invoke the `onInstall` function of the fallback handler with the provided initialization data.
479485
// This step allows the fallback handler to perform any necessary setup or initialization.
480-
IFallback(handler).onInstall(initData);
486+
if (initData.length > 0) {
487+
IFallback(handler).onInstall(initData);
488+
}
481489
}
482490

483491
/// @dev Uninstalls a fallback handler for a given selector.
@@ -521,7 +529,9 @@ abstract contract ModuleManager is AllStorage, EIP712, IModuleManager {
521529
address currentPreValidationHook = _getPreValidationHook(preValidationHookType);
522530
if (currentPreValidationHook != address(0)) revert PrevalidationHookAlreadyInstalled(currentPreValidationHook);
523531
_setPreValidationHook(preValidationHookType, preValidationHook);
524-
IModule(preValidationHook).onInstall(data);
532+
if (data.length > 0) {
533+
IModule(preValidationHook).onInstall(data);
534+
}
525535
}
526536

527537
/// @dev Uninstalls a pre-validation hook module

0 commit comments

Comments
 (0)