From bd45b0219ed2d46ebce8e1385f96951ed82cfce5 Mon Sep 17 00:00:00 2001 From: Julien Rouhaud Date: Mon, 11 Sep 2023 00:12:02 +0800 Subject: [PATCH] Fix an off-by-1 error in the buffer used to print index oid. Thanks to github user sylph520 for the report. --- hypopg_index.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hypopg_index.c b/hypopg_index.c index 2b800da..f8c7a23 100644 --- a/hypopg_index.c +++ b/hypopg_index.c @@ -1789,8 +1789,10 @@ hypo_hideIndexes(RelOptInfo *rel) static void hypo_set_indexname(hypoIndex * entry, char *indexname) { - char oid[12]; /* store , oid shouldn't be more than - * 9999999999 */ + char oid[13]; /* store , oid is an unsigned int32, so it + * shouldn't be more than 4B, so 10 digits. + * We add 2 chars for the < and > separators + * and an extra null char.*/ int totalsize; snprintf(oid, sizeof(oid), "<%d>", entry->oid);