summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2011-10-03 19:20:52 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2011-10-03 19:20:52 +0000
commit65d54d24c8660c42636983d81b47f59d2c5c1940 (patch)
tree1f23ec1837d420a2c7ca57228c2f0df4ed2166aa /usr.sbin/smtpd
parent7f96b2f9e370da08207eef2fb18888d16b1774b9 (diff)
- fix a segv caused by a deep recursion introduced with a recent quick-fix
and triggering if clients sent a large number of DATA lines in one write
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/smtp_session.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index 8f9b631247a..3c75142b8e2 100644
--- a/usr.sbin/smtpd/smtp_session.c
+++ b/usr.sbin/smtpd/smtp_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp_session.c,v 1.148 2011/09/28 18:19:10 gilles Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.149 2011/10/03 19:20:51 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -820,11 +820,13 @@ session_read(struct bufferevent *bev, void *p)
if (strlcpy(ss.u.dataline, line,
sizeof(ss.u.dataline)) >= sizeof(ss.u.dataline))
fatal("session_read: data truncation");
- free(line);
- if (env->filtermask & FILTER_DATALINE)
+ if (env->filtermask & FILTER_DATALINE) {
session_imsg(s, PROC_MFA, IMSG_MFA_DATALINE,
0, 0, -1, &ss, sizeof(ss));
+ free(line);
+ return;
+ }
else {
/* no filtering, let's pretend that filtering
* succeeded ;-)
@@ -834,7 +836,7 @@ session_read(struct bufferevent *bev, void *p)
ss.code = 250;
session_pickup(s, &ss);
}
- return;
+ break;
}
default:
@@ -915,7 +917,6 @@ session_read_data(struct session *s, char *line)
end:
bufferevent_enable(s->s_bev, EV_READ);
- session_read(s->s_bev, s);
}
static void