aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-06-05 13:34:04 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-06-08 06:39:40 +0800
commit774d831fae5809408f9ddfcf9393d579416b1bfb (patch)
tree6ea66da84f218b54263aaec1d5c6f8a5b064abc6 /packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
parenta1b49d8389844c9b2d62ded91b76a23deb060ab6 (diff)
downloaddexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar.gz
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar.bz2
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar.lz
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar.xz
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar.zst
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.zip
Style updates to ERC721 onReceiver
Diffstat (limited to 'packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol')
-rw-r--r--packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol9
1 files changed, 5 insertions, 4 deletions
diff --git a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
index 5610c47b3..8f6647d20 100644
--- a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
+++ b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
@@ -332,7 +332,8 @@ contract LibBytes is
internal
pure
{
- // Read length of nested bytes
+ // Assert length of <b> is valid, given
+ // length of input
require(
b.length >= index + 32 /* 32 bytes to store length */ + input.length,
GTE_32_LENGTH_REQUIRED
@@ -340,9 +341,9 @@ contract LibBytes is
// Copy <input> into <b>
memcpy(
- getMemAddress(b) + index + 32, // +32 to skip length of <b>
- getMemAddress(input), // include length of byte array
- input.length + 32 // +32 bytes to store length
+ getMemAddress(b) + 32 + index, // +32 to skip length of <b>
+ getMemAddress(input), // includes length of <input>
+ input.length + 32 // +32 bytes to store <input> length
);
}
}