summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2008-02-20 12:41:52 +0000
committerBrad Smith <brad@cvs.openbsd.org>2008-02-20 12:41:52 +0000
commit33e9b7f59adeaef1a835fc3f6786814ecc9517d2 (patch)
tree5e35090ecfc88bc31ca6c9034cf342df78df602d
parentef618e7d1f677bfe26b07a47c1eaa27ce54a6c69 (diff)
Fix a use-after-free bug in the envelope code just after a port 25 fork.
From Matthew Dillon@DragonFlyBSD ok millert@ dlg@
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gnu/usr.sbin/sendmail/sendmail/main.c b/gnu/usr.sbin/sendmail/sendmail/main.c
index 7963d92be7e..c3b12a67e6e 100644
--- a/gnu/usr.sbin/sendmail/sendmail/main.c
+++ b/gnu/usr.sbin/sendmail/sendmail/main.c
@@ -2517,9 +2517,12 @@ main(argc, argv, envp)
macdefine(&BlankEnvelope.e_macro, A_TEMP, '_', authinfo);
/* at this point we are in a child: reset state */
- sm_rpool_free(MainEnvelope.e_rpool);
- (void) newenvelope(&MainEnvelope, &MainEnvelope,
- sm_rpool_new_x(NULL));
+ {
+ SM_RPOOL_T *opool = MainEnvelope.e_rpool;
+ (void) newenvelope(&MainEnvelope, &MainEnvelope,
+ sm_rpool_new_x(NULL));
+ sm_rpool_free(opool);
+ }
}
if (LogLevel > 9)