From 1239060641b3a33eeefd7f72c3a53995916e01d8 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 15 Jun 2019 14:07:46 -0700 Subject: Fix for free-after-use caused by hardlinked files (reverting earlier change that assumed files with equal inode/idev were the same) --- bb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bb.c b/bb.c index 233c998..0d13f3f 100644 --- a/bb.c +++ b/bb.c @@ -752,7 +752,9 @@ entry_t* load_entry(bb_t *bb, const char *path) // Check for pre-existing: for (entry_t *e = bb->hash[(int)filestat.st_ino & HASH_MASK]; e; e = e->hash.next) { - if (e->info.st_ino == filestat.st_ino && e->info.st_dev == filestat.st_dev) + if (e->info.st_ino == filestat.st_ino && e->info.st_dev == filestat.st_dev + // Need to check filename in case of hard links + && strcmp(pbuf, e->fullname) == 0) return e; } -- cgit v1.2.3