summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortim <tim@openbsd.org>2015-11-26 08:51:22 +0000
committertim <tim@openbsd.org>2015-11-26 08:51:22 +0000
commit775712a7a07c90d65dae4761d2c3fcc7e1032086 (patch)
tree8d603f6fa40c41a6f6cb3956c4936c71cf5fc634
parentRemove vmm enable / disable in parse.y as well - (diff)
downloadwireguard-openbsd-775712a7a07c90d65dae4761d2c3fcc7e1032086.tar.xz
wireguard-openbsd-775712a7a07c90d65dae4761d2c3fcc7e1032086.zip
Don't dereference a route and then reference it again. In this particular case,
the route would be referenced at least twice, so there is no use after free. Prompted by a mail from David CARLIER to misc@opensmtpd. OK eric@
-rw-r--r--usr.sbin/smtpd/mta.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c
index 24bb10d0607..538c8c63fb2 100644
--- a/usr.sbin/smtpd/mta.c
+++ b/usr.sbin/smtpd/mta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta.c,v 1.192 2015/10/14 22:01:43 gilles Exp $ */
+/* $OpenBSD: mta.c,v 1.193 2015/11/26 08:51:22 tim Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -1246,13 +1246,13 @@ mta_route_disable(struct mta_route *route, int penalty, int reason)
log_info("smtp-out: Disabling route %s for %llus",
mta_route_to_text(route), delay);
- if (route->flags & ROUTE_DISABLED) {
+ if (route->flags & ROUTE_DISABLED)
runq_cancel(runq_route, NULL, route);
- mta_route_unref(route); /* from last call to here */
- }
+ else
+ mta_route_ref(route);
+
route->flags |= reason & ROUTE_DISABLED;
runq_schedule(runq_route, time(NULL) + delay, NULL, route);
- mta_route_ref(route);
}
static void