Fix to use proper data type for shared memory size.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 14 Jan 2021 10:38:35 +0000 (19:38 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 14 Jan 2021 10:40:04 +0000 (19:40 +0900)
pool_shared_memory_create() should use data type size_t for a variable
to store shared memory size. The data type used was int and it would
overflow if the size is big.

src/main/pgpool_main.c

index e1edf948c0353b34ae060d290f8f0d4ab7624d11..7622b0ca93db49ad27aed26ada2ad8d2517a6c34 100644 (file)
@@ -5,7 +5,7 @@
  * pgpool: a language independent connection pool server for PostgreSQL
  * written by Tatsuo Ishii
  *
- * Copyright (c) 2003-2017     PgPool Global Development Group
+ * Copyright (c) 2003-2021     PgPool Global Development Group
  *
  * Permission to use, copy, modify, and distribute this software and
  * its documentation for any purpose and without fee is hereby
@@ -3114,7 +3114,9 @@ pid_t fork_follow_child(int old_master, int new_primary, int old_primary)
 
 static void initialize_shared_mem_objects(bool clear_memcache_oidmaps)
 {
-       int size,i;
+       size_t          size;
+       int                     i;
+
        /*
         * con_info is a 3 dimension array: i corresponds to pgpool child
         * process, j corresponds to connection pool in each process and k