[nginx] Mail: fixed segfault with ssl/starttls at mail{} level a...

Maxim Dounin mdounin at mdounin.ru
Tue Oct 8 12:12:39 UTC 2013


details:   http://hg.nginx.org/nginx/rev/3ff1e663fa08
branches:  stable-1.4
changeset: 5420:3ff1e663fa08
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Mon Sep 30 22:10:13 2013 +0400
description:
Mail: fixed segfault with ssl/starttls at mail{} level and no cert.

A configuration like "mail { starttls on; server {}}" triggered NULL
pointer dereference in ngx_mail_ssl_merge_conf() as conf->file was not set.

diffstat:

 src/mail/ngx_mail_ssl_module.c |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff --git a/src/mail/ngx_mail_ssl_module.c b/src/mail/ngx_mail_ssl_module.c
--- a/src/mail/ngx_mail_ssl_module.c
+++ b/src/mail/ngx_mail_ssl_module.c
@@ -235,6 +235,11 @@ ngx_mail_ssl_merge_conf(ngx_conf_t *cf, 
        mode = "";
     }
 
+    if (conf->file == NULL) {
+        conf->file = prev->file;
+        conf->line = prev->line;
+    }
+
     if (*mode) {
 
         if (conf->certificate.len == 0) {



More information about the nginx-devel mailing list