SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
fix: resolve postgres startup message length type mismatch and uint underflow OOM risk (#10065)
198wmjaeaf62fa86b1
diff --git a/weed/server/postgres/server.go b/weed/server/postgres/server.goindex 1ac4d8b3e9..51c9fe1e38 100644--- a/weed/server/postgres/server.go+++ b/weed/server/postgres/server.go@@ -388,7 +388,13 @@ func (s *PostgreSQLServer) handleStartup(session *PostgreSQLSession) error {return fmt.Errorf("failed to read message length during startup: %v", err)}- msgLength := binary.BigEndian.Uint32(length) - 4+ msgTotalLen := binary.BigEndian.Uint32(length)+ // Prevent unsigned underflow and OOM by checking total message length first+ if msgTotalLen < 8 {+ return fmt.Errorf("startup message too short: %d bytes", msgTotalLen)+ }++ msgLength := msgTotalLen - 4if msgLength > 10000 { // Reasonable limit for startup messagesreturn fmt.Errorf("startup message too large: %d bytes", msgLength)}