mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-24 14:50:57 +01:00
Fix bug in Utils.copyOf
This commit is contained in:
parent
cb4067da09
commit
0bc87e5804
1 changed files with 3 additions and 1 deletions
|
@ -24,6 +24,7 @@ import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -286,7 +287,8 @@ public class Utils {
|
||||||
|
|
||||||
public static byte[] copyOf(byte[] in, int length) {
|
public static byte[] copyOf(byte[] in, int length) {
|
||||||
byte[] out = new byte[length];
|
byte[] out = new byte[length];
|
||||||
System.arraycopy(in, 0, out, 0, length);
|
System.arraycopy(in, 0, out, 0, Math.min(length, in.length));
|
||||||
|
Arrays.copyOf(in, 6);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue