mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 13:25:43 +01:00
lightningd: fix reference to out-of-scope var.
cppcheck found this: [lightningd/options.c:1137] -> [lightningd/options.c:1120] -> [lightningd/options.c:1193]: (error) Using pointer to local variable 'buf' that is out of scope. Indeed, answer can point into buf, which is no longer in scope at the end. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0b61781746
commit
7f36a4e3dd
@ -1081,6 +1081,7 @@ static void add_config(struct lightningd *ld,
|
||||
{
|
||||
char *name0 = tal_strndup(response, name, len);
|
||||
const char *answer = NULL;
|
||||
char buf[OPT_SHOW_LEN + sizeof("...")];
|
||||
|
||||
if (opt->type & OPT_NOARG) {
|
||||
if (opt->desc == opt_hidden) {
|
||||
@ -1117,7 +1118,6 @@ static void add_config(struct lightningd *ld,
|
||||
if (opt->desc == opt_hidden) {
|
||||
/* Ignore hidden options (deprecated) */
|
||||
} else if (opt->show) {
|
||||
char buf[OPT_SHOW_LEN + sizeof("...")];
|
||||
strcpy(buf + OPT_SHOW_LEN, "...");
|
||||
opt->show(buf, opt->u.carg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user