mirror of
https://github.com/MAGICGrants/flutter_libsparkmobile.git
synced 2026-01-06 19:53:57 -05:00
fix string length
This commit is contained in:
@@ -542,11 +542,7 @@ abstract final class LibSpark {
|
||||
return hashes;
|
||||
}
|
||||
|
||||
/// [x] and [y] must be of length 64
|
||||
static String hashTag(String x, String y) {
|
||||
assert(x.length == 64);
|
||||
assert(y.length == 64);
|
||||
|
||||
final xPtr = x.toNativeUtf8().cast<Char>();
|
||||
final yPtr = y.toNativeUtf8().cast<Char>();
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ const char* hashTag(const char* x, const char* y) {
|
||||
secp_primitives::GroupElement tag = secp_primitives::GroupElement(x, y, 16);
|
||||
uint256 hash = primitives::GetLTagHash(tag);
|
||||
std::string hex = hash.GetHex();
|
||||
char* result = (char*) malloc(sizeof(char) * hex.length());
|
||||
char* result = (char*) malloc(sizeof(char) * (hex.length() + 1));
|
||||
strcpy(result, hex.c_str());
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user