From 0bae682a0d276b1636a91cdcd9b74179f21218b8 Mon Sep 17 00:00:00 2001 From: Dan Farina Date: Thu, 23 Dec 2010 00:46:59 -0800 Subject: [PATCH] Fix off-by-one in passing buffer size to xsnprintf This would cause a consistent panic (exit() call) without reason. This should not enable any overruns (but check my work). Signed-off-by: Dan Farina --- repmgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repmgr.c b/repmgr.c index 4403215c..eb07c67a 100644 --- a/repmgr.c +++ b/repmgr.c @@ -883,7 +883,7 @@ do_standby_clone(void) size_t buf_sz = strlen(first_wal_seg_pq); first_wal_segment = malloc(buf_sz + 1); - xsnprintf(first_wal_segment, buf_sz, "%s", first_wal_seg_pq); + xsnprintf(first_wal_segment, buf_sz + 1, "%s", first_wal_seg_pq); } first_wal_segment = PQgetvalue(res, 0, 0);