Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
smtpd: catch EOFs in table_proc handshake
To:
tech@openbsd.org
Date:
Wed, 22 May 2024 19:39:15 +0200

Download raw body.

Thread
spotted thanks to a faulty table while I was testing something.  while
here, also fix a fatalx -> fatal since getline sets errno on failure.

ok?

diff refs/remotes/origin/master refs/heads/master
commit - aeac25c2f26faebdbee9d841a3d05219f83f6d4a
commit + 579b484995821ef821ef1599b6b8b67a46763ca3
blob - 07cabf073bc4155c8972a7614d75eb10eb9899fe
blob + 52cd505fa056bb97bba9409e9304e34880490379
--- usr.sbin/smtpd/table_proc.c
+++ usr.sbin/smtpd/table_proc.c
@@ -166,8 +166,9 @@ table_proc_open(struct table *table)
 	}
 
 	if (ferror(priv->in))
-		fatalx("table-proc: getline");
-
+		fatal("table-proc: getline");
+	if (feof(priv->in))
+		fatalx("table-proc: unexpected EOF during handshake");
 	if (services == 0)
 		fatalx("table-proc: no services registered");