Browse Source

daemon: Fix issue 2348, db->filenam not being correctly initialized

We were not correctly allocating the `db->filename`, failing to copy the
null-terminator. This was causing and error when reopening the database after
the call to `fork()`.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
Reported-by: Sean McNally <@sfmcnally>
Changelog-fixed: Fixed a crash when running in daemon-mode due to db filename overrun
connected_hook
Christian Decker 6 years ago
parent
commit
a405c22fc9
  1. 2
      wallet/db.c

2
wallet/db.c

@ -557,7 +557,7 @@ static struct db *db_open(const tal_t *ctx, char *filename)
}
db = tal(ctx, struct db);
db->filename = tal_dup_arr(db, char, filename, strlen(filename), 0);
db->filename = tal_strdup(db, filename);
db->sql = sql;
tal_add_destructor(db, destroy_db);
db->in_transaction = NULL;

Loading…
Cancel
Save