On 08/01/2015 00:25, Brian Eliassen wrote:

I'm doing a standard build on Solaris 10 with Dovecot 2.2.15 without
anything fancy:

./configure
make
make check
make install

Configure output looks like this:
***
Install prefix . : /usr/local

Oooh, I suggest you use /opt

./configure \
--prefix=${PREFIX} \
--sysconfdir=/etc/opt/${PREFIX} \
--localstatedir=/var/opt/${PREFIX} \
...

$ man -s 5 filesystem



$ mdb test-http-auth core
Loading modules: [ libc.so.1 ld.so.1 ]
::stack
libc.so.1`strlen+0x50(29487, ffbffb00, ffbff43d, 0, 0, 0)
libc.so.1`vsnprintf+0x70(4f2c0, 10f, 29478, ffbffaf8, 10, ff1c7078)
t_noalloc_strdup_vprintf+0x3c(4f2c0, ffbffaf8, ffbffa2c, 1, 19, 0)
p_strdup_vprintf+0xc(4cb90, 29478, ffbffaf8, ff1c759c, 4cc38, 4cb8c)
t_strdup_printf+0x38(29478, 0, 0, 61fefeff, 80808080, 1010101)

Spot the zeros.  It's doing the equivalent of 'vsnprintf(s, "%s", 0);'.

The check will run by changing the test code and not attempting to print nulls, patch file attached. I've not thought about this deeply and this is no more than a hack to get the test to run, I didn't study the result.

On face value the core dump says dovecot has failed the test because its string functions don't take nulls, that is if dovecot ever sends them nulls which I can't say other than dovecot does run without dumping core. If there is the possibility nulls need to be printed the dovecot functions in src/lib/strfuncs.c need fixing.








--- ../original/src/lib-http/test-http-auth.c   2014-09-24 20:34:27.000000000 
+0100
+++ src/lib-http/test-http-auth.c       2015-01-10 15:22:59.083365723 +0000
@@ -120,7 +120,7 @@
                                                        strcmp(chalo->scheme, 
chalt->scheme) == 0);
                                        if (chalo->data == NULL || chalt->data 
== NULL) {
                                                
test_out(t_strdup_printf("[%d]->data = %s",
-                                                       index, 
str_sanitize(chalo->data, 80)),
+                                                       index, 
str_sanitize(chalo->data == NULL ? "NULL" : chalo->data, 80)),
                                                        chalo->data == 
chalt->data);
                                        } else {
                                                
test_out(t_strdup_printf("[%d]->data = %s",
@@ -230,7 +230,7 @@
                                        strcmp(out.scheme, test->scheme) == 0);
                        if (out.data == NULL || test->data == NULL) {
                                test_out(t_strdup_printf("->data = %s",
-                                       str_sanitize(out.data, 80)),
+                                       str_sanitize(out.data == NULL ? "NULL" 
: out.data, 80)),
                                        out.data == test->data);
                        } else {
                                test_out(t_strdup_printf("->data = %s",
--- ../original/src/lib-http/test-http-request-parser.c 2014-06-02 
12:50:10.000000000 +0100
+++ src/lib-http/test-http-request-parser.c     2015-01-10 15:25:52.198118307 
+0000
@@ -269,7 +269,7 @@
                
                        if (payload == NULL || test->payload == NULL) {
                                test_out(t_strdup_printf("request->payload = 
%s",
-                                       str_sanitize(payload, 80)),
+                                       str_sanitize(payload == NULL ? "NULL" : 
payload, 80)),
                                        payload == test->payload);
                        } else {
                                test_out(t_strdup_printf("request->payload = 
%s",
--- ../original/src/lib-imap/test-imap-url.c    2014-07-03 10:44:49.000000000 
+0100
+++ src/lib-imap/test-imap-url.c        2015-01-10 15:57:26.923109229 +0000
@@ -637,14 +637,14 @@
                                               strcmp(urlp->host_name, 
urlt->host_name) == 0);
                        }
                        if (urlp->userid == NULL || urlt->userid == NULL) {
-                               test_out_quiet(t_strdup_printf("url->userid = 
%s", urlp->userid),
+                               test_out_quiet(t_strdup_printf("url->userid = 
%s", urlp->userid == NULL ? "NULL" : urlp->userid),
                                               urlp->userid == urlt->userid);
                        } else {
                                test_out_quiet(t_strdup_printf("url->userid = 
%s", urlp->userid),
                                               strcmp(urlp->userid, 
urlt->userid) == 0);
                        }
                        if (urlp->auth_type == NULL || urlt->auth_type == NULL) 
{
-                               test_out_quiet(t_strdup_printf("url->auth_type 
= %s", urlp->auth_type),
+                               test_out_quiet(t_strdup_printf("url->auth_type 
= %s", urlp->auth_type == NULL ? "NULL" : urlp->auth_type),
                                               urlp->auth_type == 
urlt->auth_type);
                        } else {
                                test_out_quiet(t_strdup_printf("url->auth_type 
= %s", urlp->auth_type),
@@ -665,7 +665,7 @@
                                               urlp->have_host_ip == 
urlt->have_host_ip);
                        }
                        if (urlp->mailbox == NULL || urlt->mailbox == NULL) {
-                               test_out_quiet(t_strdup_printf("url->mailbox = 
%s", urlp->mailbox),
+                               test_out_quiet(t_strdup_printf("url->mailbox = 
%s", urlp->mailbox == NULL ? "NULL" : urlp->mailbox),
                                               urlp->mailbox == urlt->mailbox);
                        } else {
                                test_out_quiet(t_strdup_printf("url->mailbox = 
%s", urlp->mailbox),
@@ -676,7 +676,7 @@
                        test_out_quiet(t_strdup_printf("url->uid = %u", 
urlp->uid),
                                       urlp->uid == urlt->uid);
                        if (urlp->section == NULL || urlt->section == NULL) {
-                               test_out_quiet(t_strdup_printf("url->section = 
%s", urlp->section),
+                               test_out_quiet(t_strdup_printf("url->section = 
%s", urlp->section == NULL ? "NULL" : urlp->section),
                                               urlp->section == urlt->section);
                        } else {
                                test_out_quiet(t_strdup_printf("url->section = 
%s", urlp->section),
@@ -688,7 +688,7 @@
                                       urlp->partial_size == 
urlt->partial_size);
                        if (urlp->search_program == NULL || 
urlt->search_program == NULL) {
                                test_out_quiet(t_strdup_printf(
-                                                      "url->search_program = 
%s", urlp->search_program),
+                                                      "url->search_program = 
%s", urlp->search_program == NULL ? "NULL" : urlp->search_program),
                                               urlp->search_program == 
urlt->search_program);
                        } else {
                                test_out_quiet(t_strdup_printf(
@@ -718,7 +718,7 @@
                                if (urlp->uauth_access_user == NULL ||
                                    urlt->uauth_access_user == NULL) {
                                        
test_out_quiet(t_strdup_printf("url->uauth_access_user = %s",
-                                                                      
urlp->uauth_access_user),
+                                                                      
urlp->uauth_access_user == NULL ? "NULL" : urlp->uauth_access_user),
                                                       urlp->uauth_access_user 
== urlt->uauth_access_user);
                                } else {
                                        
test_out_quiet(t_strdup_printf("url->uauth_access_user = %s",
@@ -728,7 +728,7 @@
                                }
                                if (urlp->uauth_mechanism == NULL || 
urlt->uauth_mechanism == NULL) {
                                        test_out_quiet(t_strdup_printf(
-                                                              
"url->uauth_mechanism = %s", urlp->uauth_mechanism),
+                                                              
"url->uauth_mechanism = %s", urlp->uauth_mechanism == NULL ? "NULL" : 
urlp->uauth_mechanism),
                                                       urlp->uauth_mechanism == 
urlt->uauth_mechanism);
                                } else {
                                        test_out_quiet(t_strdup_printf(
@@ -737,7 +737,7 @@
                                }
                                if (urlp->uauth_token == NULL || 
urlt->uauth_token == NULL) {
                                        test_out_quiet(t_strdup_printf(
-                                                              
"url->uauth_token = %s", urlp->uauth_token),
+                                                              
"url->uauth_token = %s", urlp->uauth_token == NULL ? (unsigned char *) "NULL" : 
urlp->uauth_token),
                                                       urlp->uauth_token == 
urlt->uauth_token);
                                } else {
                                        bool equal = urlp->uauth_token_size == 
urlt->uauth_token_size;

Reply via email to