summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-12-22 16:56:22 -0500
committerJune McEnroe <june@causal.agency>2019-12-22 16:56:22 -0500
commitba7e76f2cee6e1ee6c7eb1709370a1fbddea50a1 (patch)
treea7e3db21076fd234af2ff37739a81d741631563c
parentRevert "Exit when server gets POLLHUP" (diff)
downloadpounce-ba7e76f2cee6e1ee6c7eb1709370a1fbddea50a1.tar.gz
pounce-ba7e76f2cee6e1ee6c7eb1709370a1fbddea50a1.zip
Exit on zero-length server read
-rw-r--r--server.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/server.c b/server.c
index 80d34df..ce5ae87 100644
--- a/server.c
+++ b/server.c
@@ -130,6 +130,7 @@ void serverRecv(void) {
 	ssize_t read = tls_read(client, &buf[len], sizeof(buf) - len);
 	if (read == TLS_WANT_POLLIN || read == TLS_WANT_POLLOUT) return;
 	if (read < 0) errx(EX_IOERR, "server tls_read: %s", tls_error(client));
+	if (!read) errx(EX_PROTOCOL, "server closed connection");
 	len += read;
 
 	char *crlf;