mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-18 21:32:35 +01:00
ByteArray: add defensive copy in bytes()
getter
This commit is contained in:
parent
49f7ddbc0f
commit
07ca73cce7
@ -38,7 +38,9 @@ public class ByteArray implements Comparable<ByteArray> {
|
||||
* @return the key bytes
|
||||
*/
|
||||
public byte[] bytes() {
|
||||
return bytes;
|
||||
byte[] copy = new byte[bytes.length];
|
||||
System.arraycopy(bytes, 0, copy, 0, bytes.length);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user