diff --git a/src/database.c b/src/database.c index ffcf9c9..addf45c 100644 --- a/src/database.c +++ b/src/database.c @@ -85,7 +85,7 @@ int imdb_open(imdb_db_t *db, const char *path, int write) return -1; } db->write = write; - db->path = path; + strncpy(db->path, path, sizeof(db->path)); DB_READ(db, buf, IMDB_REC_LEN, 0); diff --git a/src/database.h b/src/database.h index 136e35f..337fca1 100644 --- a/src/database.h +++ b/src/database.h @@ -7,7 +7,7 @@ typedef struct { int fd; int write; - const char *path; + char path[PATH_MAX]; const char *errstr; unsigned char caps[8]; } imdb_db_t;