From 6efdb1d0f3ab0e95c7958078251efeb1956fe2dc Mon Sep 17 00:00:00 2001 From: Matthias van de Meent Date: Tue, 1 Oct 2024 18:37:59 +0200 Subject: [PATCH] Fix small memory accounting bug in libpagestore (#9223) Found while searching for other issues in shared memory. The bug should be benign, in that it over-allocates memory for this struct, but doesn't allow for out-of-bounds writes. --- pgxn/neon/libpagestore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pgxn/neon/libpagestore.c b/pgxn/neon/libpagestore.c index 07a19a7114..6c6489277d 100644 --- a/pgxn/neon/libpagestore.c +++ b/pgxn/neon/libpagestore.c @@ -937,7 +937,7 @@ PagestoreShmemInit(void) LWLockAcquire(AddinShmemInitLock, LW_EXCLUSIVE); pagestore_shared = ShmemInitStruct("libpagestore shared state", - PagestoreShmemSize(), + sizeof(PagestoreShmemState), &found); if (!found) {