pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: can not download IMAP messages with isync/mbsync



On Mon, 14 Nov 2022, Mouse wrote:

My guess is that the buffer you're testing with is near the top of the
address space, within ~1GB of address 0xffffffff, and what you're
seeing is due to wraparound.


Thanks for that analysis--address-wrapping was my first guess too, but,
I didn't have the time to confirm it: the 1GB was with a standalone
program; in mbsync itself, the range was much smaller--less than 1MB even.

Also,

-			uint maxlen = UINT_MAX;
+			uint maxlen = sizeof(buf);

if maxlen is passed unchanged to strnlen, I can't see how the original
code isn't a bug; there's no point in using strnlen if you're pass a
maxlen greater than the space remaining in the buffer your pointer
points into.


It _is_ passed as-is to strnlen(). I chose sizeof(buf) instead of UINT_MAX
because `buf' seemed sized for the RFC-5322 recommended line-length limit
of 998 octets.

The 9.1 manpage for strnlen says

    The strnlen() function returns either the same result as strlen() or
    maxlen, whichever is smaller.

which makes this a violation of its spec.


Right, then Marko can file a PR so that this can be fixed a) either in the
ARM assembly, or b) by NetBSD-ARM just using the C version like the other
ports.

Thx,
-RVP


Home | Main Index | Thread Index | Old Index