From 194b5f7f4e10d850e9da91437624f203e1ed2af4 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Sun, 30 Sep 2012 21:10:51 +0330 Subject: [PATCH] smtp: bail out if the mail is too big --- smtp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/smtp.c b/smtp.c index e2aae22..8e7144f 100644 --- a/smtp.c +++ b/smtp.c @@ -270,7 +270,8 @@ static struct account *choose_account(void) int main(int argc, char *argv[]) { struct account *account; - if ((mail_len = xread(STDIN_FILENO, mail, sizeof(mail))) == -1) + mail_len = xread(STDIN_FILENO, mail, sizeof(mail)); + if (mail_len < 0 || mail_len >= sizeof(mail)) return 1; account = choose_account(); conn = conn_connect(account->server, account->port, account->cert); -- 2.11.4.GIT