Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: don't crash when there's no argument #6568

Merged

Conversation

endothermicdev
Copy link
Collaborator

This should provide the default help message and exit, but freeing pointers passed to the default config setup lead to a segmentation fault when help tries to provide usage and triggers the callback.

Program received signal SIGSEGV, Segmentation fault.
__strlen_generic () at ../sysdeps/aarch64/multiarch/../strlen.S:98
98	../sysdeps/aarch64/multiarch/../strlen.S: No such file or directory.
(gdb) bt
#0  __strlen_generic () at ../sysdeps/aarch64/multiarch/../strlen.S:98
#1  0x000000555555b9f0 in opt_show_charp (
    buf=0x7ffffff0a0 "\"Usage: /usr/local/bin/lightning-cli <command> [<params>...]\n--conf=<file>     \"...", len=80, p=0x7ffffff150)
    at ccan/ccan/opt/helpers.c:216
#2  0x000000555555d9b4 in add_desc (
    base=0x555557dff8 "Usage: /usr/local/bin/lightning-cli <command> [<params>...]\n--conf=<file>", ' ' <repeats 13 times>, "Specify configuration file\n", ' ' <repeats 27 times>, "(default: \"Usage: /usr/local/bin/lightning-cli <command> [<p"..., len=0x7ffffff130, 
    max=0x7ffffff128, indent=26, width=137, opt=0x555557dbd0) at ccan/ccan/opt/usage.c:154
#3  0x000000555555df5c in opt_usage (argv0=0x7ffffff687 "/usr/local/bin/lightning-cli", extra=0x55555659b0 "<command> [<params>...]")
    at ccan/ccan/opt/usage.c:232
#4  0x0000005555554674 in main (argc=1, argv=0x7ffffff448) at cli/lightning-cli.c:705

Changelog-Fixed: lightning-cli properly returns help without argument

This should provide the default help message and exit, but was
resulting in a segmentation fault from freeing pointers passed to
the default config.

Changelog-Fixed: lightning-cli properly returns help without argument
@rustyrussell rustyrussell added this to the v23.08 milestone Aug 15, 2023
@rustyrussell rustyrussell merged commit 5533698 into ElementsProject:master Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants