Reject CancelRequestPacket having unexpected length.

Noah Misch <noah@leadboat.com>

Commit: b152bb7b2724a7c62c2440c510af4926a996bbbc
Author: Noah Misch <noah@leadboat.com>
Date: 2023-01-21T14:08:03Z
Releases: 15.2
Reject CancelRequestPacket having unexpected length.

When the length was too short, the server read outside the allocation.
That yielded the same log noise as sending the correct length with
(backendPID,cancelAuthCode) matching nothing.  Change to a message about
the unexpected length.  Given the attacker's lack of control over the
memory layout and the general lack of diversity in memory layouts at the
code in question, we doubt a would-be attacker could cause a segfault.
Hence, while the report arrived via security@postgresql.org, this is not
a vulnerability.  Back-patch to v11 (all supported versions).

Andrey Borodin, reviewed by Tom Lane.  Reported by Andrey Borodin.

Files

PathChange+/−
src/backend/postmaster/postmaster.c modified +7 −0