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:38 +0000 (22:46 +0900)
Fix "insecure data handling".
Per Coverity (CID 1559731)

src/protocol/pool_process_query.c

index be6f2abed0dc09601347a827655705cbba46d61e..544e212da7cde786c3c4c94180bc0fd200cd30aa 100644 (file)
@@ -5212,10 +5212,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);
                }