gdbm/gdbm-1.17-entry-validation.patch
2018-08-21 11:37:32 +02:00

28 lines
974 B
Diff

From 64ef7e827406f91d31bffdcad9f4b8aaad1f874c Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Sun, 19 Aug 2018 06:50:22 +0000
Subject: Fix directory entry validation.
Bug reported by Miroslav Lichvar and Marek Skalický
* src/bucket.c (gdbm_dir_entry_valid_p): Fix lower limit for
the allowed bucket address. Initial allocation of second block
for the directory can be eventually returned to the available
list when the directory is expanded during bucket splitting.
---
diff --git a/src/bucket.c b/src/bucket.c
index 0597965..3d267e2 100644
--- a/src/bucket.c
+++ b/src/bucket.c
@@ -54,7 +54,7 @@ gdbm_dir_entry_valid_p (GDBM_FILE dbf, int dir_index)
{
return dir_index >= 0
&& dir_index < GDBM_DIR_COUNT (dbf)
- && dbf->dir[dir_index] >= 2*dbf->header->block_size;
+ && dbf->dir[dir_index] >= dbf->header->block_size;
}
/* Find a bucket for DBF that is pointed to by the bucket directory from
--
cgit v0.9.0.3