File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -4667,16 +4667,28 @@ func UnmarshalUniID(rpcID *unirpc.ID) (universe.Identifier, error) {
46674667 }
46684668 switch {
46694669 case rpcID .GetAssetId () != nil :
4670+ rpcAssetID := rpcID .GetAssetId ()
4671+ if len (rpcAssetID ) != sha256 .Size {
4672+ return universe.Identifier {}, fmt .Errorf ("asset ID " +
4673+ "must be 32 bytes" )
4674+ }
4675+
46704676 var assetID asset.ID
4671- copy (assetID [:], rpcID . GetAssetId () )
4677+ copy (assetID [:], rpcAssetID )
46724678
46734679 return universe.Identifier {
46744680 AssetID : assetID ,
46754681 ProofType : proofType ,
46764682 }, nil
46774683
46784684 case rpcID .GetAssetIdStr () != "" :
4679- assetIDBytes , err := hex .DecodeString (rpcID .GetAssetIdStr ())
4685+ rpcAssetIDStr := rpcID .GetAssetIdStr ()
4686+ if len (rpcAssetIDStr ) != sha256 .Size * 2 {
4687+ return universe.Identifier {}, fmt .Errorf ("asset ID string " +
4688+ "must be 64 bytes" )
4689+ }
4690+
4691+ assetIDBytes , err := hex .DecodeString (rpcAssetIDStr )
46804692 if err != nil {
46814693 return universe.Identifier {}, err
46824694 }
You can’t perform that action at this time.
0 commit comments