dovecot-2.4.2: doveconf seg fault

Eray Aslan via dovecot <[email protected]>
Newsgroups gmane.mail.imap.dovecot
Message-ID <[email protected]>
Running dovecot -c /dev/null -n results in:

# 2.4.2 (0962ed2104): /dev/null
# Pigeonhole version 2.4.2 (767418c3)

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7c0f3a6 in str_to_uint () at ../lib/strnum.c:76

for a user. And the issue seems to be const unsigned char ** vs const
char * mismatch:

int str_to_uintmax(const char *str, uintmax_t *num_r)
{
        const char *endp = NULL;
        uintmax_t n;
        int ret = str_parse_uintmax(str, &n, &endp);
        if ((ret != 0) || (*endp != '\0')) /* <--- reading via 'const char *'
                return -1;
        *num_r = n;
        return 0;
}

vs

int str_parse_data_uintmax(const unsigned char *data, size_t size,
                           uintmax_t *num_r, const unsigned char **endp_r)
{
        const unsigned char *p = data, *pend = data + size;
        uintmax_t n = 0;

        if (p >= pend || *p < '0' || *p > '9')
                return -1;

        do {
                if (n >= ((uintmax_t)-1 / 10)) {
                        if (n > (uintmax_t)-1 / 10)
                                return -1;
                        if ((uintmax_t)(*p - '0') > ((uintmax_t)-1 % 10))
                                return -1;
                }
                n = n * 10 + (*p - '0');
                p++;
        } while (p < pend && *p >= '0' && *p <= '9');

        if (endp_r != NULL)
                *endp_r = p; /* <--- writing via 'const unsigned char *'
        *num_r = n;
        return 0;
}

We don't know enough to choose which one would be preferable so that the
interfaces match. It needs an informed decision as it shows up in a
bunch of other places as well.

More details at: https://bugs.gentoo.org/971191

Thank you
-- 
Eray

_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.