diff options
author | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-09-04 11:44:24 +0000 |
---|---|---|
committer | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-09-04 11:44:24 +0000 |
commit | b61e4f581dc2071fa5ca2f5cf7bc0903e21b9efe (patch) | |
tree | 5ea8180b8e5dd3c3cc6553908ee447da87811ba2 /usr.sbin/smtpd/queue_shared.c | |
parent | 65b93c258bf156ae4199603a900a7d1106018b97 (diff) |
Fix a crash when messagep->batch_id is read from disk and used long
after the batch has ceased to exist.
From gilles@
Diffstat (limited to 'usr.sbin/smtpd/queue_shared.c')
-rw-r--r-- | usr.sbin/smtpd/queue_shared.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/queue_shared.c b/usr.sbin/smtpd/queue_shared.c index 75425d2b1a5..dc02b120d60 100644 --- a/usr.sbin/smtpd/queue_shared.c +++ b/usr.sbin/smtpd/queue_shared.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue_shared.c,v 1.22 2009/08/08 23:02:43 gilles Exp $ */ +/* $OpenBSD: queue_shared.c,v 1.23 2009/09/04 11:44:23 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -494,6 +494,10 @@ queue_update_envelope(struct message *messagep) char temp[MAXPATHLEN]; char dest[MAXPATHLEN]; FILE *fp; + u_int64_t batch_id; + + batch_id = messagep->batch_id; + messagep->batch_id = 0; if (! bsnprintf(temp, sizeof(temp), "%s/envelope.tmp", PATH_QUEUE)) fatalx("queue_update_envelope"); @@ -523,6 +527,7 @@ queue_update_envelope(struct message *messagep) fatal("queue_update_envelope: rename"); } + messagep->batch_id = batch_id; return 1; tempfail: @@ -531,6 +536,7 @@ tempfail: if (fp) fclose(fp); + messagep->batch_id = batch_id; return 0; } |