Enforce that assetData is padded to 32 bytes, excluding the id, before dispatching transfer

This commit is contained in:
Amir Bandeali
2019-10-04 18:04:44 -07:00
parent 2020d87824
commit c0c27ed637

View File

@@ -88,8 +88,9 @@ contract MixinAssetProxyDispatcher is
{ {
// Do nothing if no amount should be transferred. // Do nothing if no amount should be transferred.
if (amount > 0) { if (amount > 0) {
// Ensure assetData length is valid
if (assetData.length <= 3) { // Ensure assetData is padded to 32 bytes (excluding the id) and is at least 4 bytes long
if (assetData.length % 32 != 4) {
LibRichErrors.rrevert(LibExchangeRichErrors.AssetProxyDispatchError( LibRichErrors.rrevert(LibExchangeRichErrors.AssetProxyDispatchError(
LibExchangeRichErrors.AssetProxyDispatchErrorCodes.INVALID_ASSET_DATA_LENGTH, LibExchangeRichErrors.AssetProxyDispatchErrorCodes.INVALID_ASSET_DATA_LENGTH,
orderHash, orderHash,