Skip to content

Commit

Permalink
hsmtool: don't streq() on NULL
Browse files Browse the repository at this point in the history
This would cause a segfault on the default network parameter for
`dumponchaindescriptors`.

Introduced in 1513a2d

Changelog-Fixed: hsmtool: fix a segfault on `dumponchaindescriptors` without network parameter
Signed-off-by: Antoine Poinsot <[email protected]>
  • Loading branch information
darosior authored and cdecker committed Jan 20, 2021
1 parent 4dfbee4 commit 4859567
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/hsmtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,9 @@ int main(int argc, char *argv[])
if (deprecated_apis && argc > 4)
net = argv[4];

if (streq(net, "testnet"))
if (net && streq(net, "testnet"))
is_testnet = true;
else if (!streq(net, "bitcoin"))
else if (net && !streq(net, "bitcoin"))
errx(ERROR_USAGE, "Network '%s' not supported."
" Supported networks: bitcoin (default),"
" testnet", net);
Expand Down

0 comments on commit 4859567

Please sign in to comment.