From dd6ecace4107ab9686b3a1a5aecced6906c9969e Mon Sep 17 00:00:00 2001 From: uwezkhan06 Date: Tue, 31 Mar 2026 00:37:02 +0530 Subject: [PATCH] Fix buffer overflow in PROXY protocol header parsing --- sql/proxy_protocol.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/proxy_protocol.cc b/sql/proxy_protocol.cc index af56a615eabfa..85d3905432336 100644 --- a/sql/proxy_protocol.cc +++ b/sql/proxy_protocol.cc @@ -195,10 +195,10 @@ int parse_proxy_protocol_header(NET *net, proxy_peer_info *peer_info) if (have_v1_header) { /* Read until end of header (newline character)*/ - while(pos < sizeof(hdr)) + while(pos < sizeof(hdr) - 1) { long len= (long)vio_read(vio, hdr + pos, 1); - if (len < 0) + if (len <= 0) return -1; pos++; if (hdr[pos-1] == '\n')