Fix bug in do_query.
authorTatsuo Ishii <ishii@postgresql.org>
Fri, 15 Nov 2024 08:08:26 +0000 (17:08 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Fri, 15 Nov 2024 08:55:23 +0000 (17:55 +0900)
commit8343af575acf67b26613332adb04a49dcff378f5
tree9aeb43ae77702664a16c5afdeb72c43e465d3c97
parent06f4f0894712cb4fa5f228e4959c7af8f1dfe9f2
Fix bug in do_query.

Upon receiving DataRow packet, it converts the number of fields from
network byte order to host byte order.  Unfortunately it used htons()
for this purpose instead of ntohs(). This is simply wrong. Similarly it
used htonl() instead of htohl() while converting the data length from
network byte order to host byte order. This is wrong too. But
fortunately both ntohs()/htons() and ntohl()/htonl() swap the byte and
they bring the same result (i.e. htonl(data_len) ==
ntohl(data_len). So actually the bug does not hurt anything.
However a bug is a bug. This commit fixes them.

Backpatch-through: v4.1
src/protocol/pool_process_query.c