benbjohnson / postlite

Postgres wire compatible SQLite proxy.
Apache License 2.0
1.21k stars 30 forks source link

Improve startup state handling #16

Open losfair opened 2 years ago

losfair commented 2 years ago

It looks like a remote denial-of-service (via stack overflow) on the server can be triggered by continuously sending SSLRequest, since handleSSLRequestMessage recursively calls serveConnStartup and the call from serveConnStartup to handleSSLRequestMessage isn't a tail call.

This PR introduces a startupState type for managing the lifecycle of the startup phase.