Hi,

In addition, there are other places where the additional byte
needs to be accounted for, e.g. in makeun() within this file.
Not sure whether there are others.

There is already a +1 in makeun.
         *addrlen = nam->m_len + 1;

Yes, that's what I was trying to hint at. Here the m_len
does include the terminating '\0' byte, so it should be
something like (untested):

static struct sockaddr_un *
makeun(struct mbuf *nam, size_t *addrlen) {
        *addrlen = nam->m_len;
        sun = malloc(*addrlen, M_SONAME, M_WAITOK);
        m_copydata(nam, 0, nam->m_len, (void *)sun);
        sun->sun_len = strlen(sun->sun_path)  +
                offsetof(struct sockaddr_un, sun_path);
        return sun;
}

Ciao,
Wolfgang
--
[email protected]                           Wolfgang Solfrank

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to