mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
Check hex_decode(...) return value
This commit is contained in:
parent
9efe123a0d
commit
148aaa79d5
@ -24,7 +24,9 @@ static void do_generate(int argc, char **argv)
|
||||
memset(&assocdata, 'B', sizeof(assocdata));
|
||||
|
||||
for (int i = 0; i < num_hops; i++) {
|
||||
hex_decode(argv[1 + i], 66, privkeys[i], 33);
|
||||
if (!hex_decode(argv[1 + i], 66, privkeys[i], 33)) {
|
||||
errx(1, "Invalid private key hex '%s'", argv[1 + i]);
|
||||
}
|
||||
if (secp256k1_ec_pubkey_create(secp256k1_ctx, &path[i].pubkey,
|
||||
privkeys[i]) != 1)
|
||||
errx(1, "Could not decode pubkey");
|
||||
@ -76,7 +78,9 @@ static void do_decode(int argc, char **argv)
|
||||
if (!read_all(STDIN_FILENO, hextemp, sizeof(hextemp)))
|
||||
errx(1, "Reading in onion");
|
||||
|
||||
hex_decode(hextemp, sizeof(hextemp), serialized, sizeof(serialized));
|
||||
if (!hex_decode(hextemp, sizeof(hextemp), serialized, sizeof(serialized))) {
|
||||
errx(1, "Invalid onion hex '%s'", hextemp);
|
||||
}
|
||||
|
||||
msg = parse_onionpacket(ctx, serialized, sizeof(serialized));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user