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

Maxim Dounin mdounin at mdounin.ru
Mon Sep 30 18:11:02 UTC 2013


details:   http://hg.nginx.org/nginx/rev/09fc4598fc8e
branches:  
changeset: 5401:09fc4598fc8e
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