with new fork+reexec, in case of failure in init of any child process
authorgilles <gilles@openbsd.org>
Mon, 20 Jun 2016 20:26:04 +0000 (20:26 +0000)
committergilles <gilles@openbsd.org>
Mon, 20 Jun 2016 20:26:04 +0000 (20:26 +0000)
causing it to exit, we could end up with a NULL deref in parent.

free commit offered by eric@, ok gilles@

usr.sbin/smtpd/smtpd.c

index a3d3eee..b510c29 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: smtpd.c,v 1.278 2016/06/07 06:52:49 gilles Exp $      */
+/*     $OpenBSD: smtpd.c,v 1.279 2016/06/20 20:26:04 gilles Exp $      */
 
 /*
  * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -161,6 +161,9 @@ parent_imsg(struct mproc *p, struct imsg *imsg)
        void                    *i;
        int                      fd, n, v, ret;
 
+       if (imsg == NULL)
+               exit(1);
+       
        if (p->proc == PROC_LKA) {
                switch (imsg->hdr.type) {
                case IMSG_LKA_OPEN_FORWARD: