mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
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
This commit is contained in:
parent
3db534580c
commit
a405c22fc9
@ -557,7 +557,7 @@ static struct db *db_open(const tal_t *ctx, char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
db = tal(ctx, struct db);
|
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;
|
db->sql = sql;
|
||||||
tal_add_destructor(db, destroy_db);
|
tal_add_destructor(db, destroy_db);
|
||||||
db->in_transaction = NULL;
|
db->in_transaction = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user