Fix pool_push_pending_data().
authorTatsuo Ishii <ishii@postgresql.org>
Sat, 14 Sep 2024 13:41:30 +0000 (22:41 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Sat, 14 Sep 2024 13:46:52 +0000 (22:46 +0900)
Fix "insecure data handling".
Per Coverity (CID 1559731)

src/protocol/pool_process_query.c

index 575b61e408bcbf881cadbd340b6c309bc7553e26..8768f4a9220f22206c5675be22c2d2ae16a89110 100644 (file)
@@ -5183,10 +5183,10 @@ pool_push_pending_data(POOL_CONNECTION * backend)
 
                len_save = len;
                len = ntohl(len);
+               len -= sizeof(len);
                buf = NULL;
-               if ((len - sizeof(len)) > 0)
+               if (len  > 0)
                {
-                       len -= sizeof(len);
                        buf = palloc(len);
                        pool_read(backend, buf, len);
                }