Port-arm 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, 7 Nov 2022, RVP wrote:

I've not been able to reproduce this at all even with 3 servers (2
providers and 1 local [dovecot +COMPRESS]) on 9.3_STABLE/amd64.


OK. Once I had QEMU + NetBSD-ARMv7 running, it turned out to be an easy
issue to diagnose. Turn out, on ARM, strnlen(3) is written in assembly
and this always returns `maxlen' for any value of `maxlen' > ~1GB. I
don't know any ARM assembly, so I haven't chased this any further.

The fix is either:

a) Configure isync-1.4.4 to _not_ use the system strnlen(). It will
   then use its own implementation which seems to work fine.

```
$ env ac_cv_func_strnlen=no ./configure ...
$ make
$ make install
```

OR

b) Apply this patch:

```
diff -urN isync-1.4.4.orig/src/drv_imap.c isync-1.4.4/src/drv_imap.c
--- isync-1.4.4.orig/src/drv_imap.c	2021-12-03 10:56:16.000000000 +0000
+++ isync-1.4.4/src/drv_imap.c	2022-11-14 06:58:25.037251216 +0000
@@ -541,7 +541,7 @@
 				add_seg( s, l );
 			if (!c)
 				break;
-			uint maxlen = UINT_MAX;
+			uint maxlen = sizeof(buf);
 			c = *++fmt;
 			if (c == '\\') {
 				c = *++fmt;
```

This restricts `maxlen' to the size of the buffer we're using. (The amt.
actually written will of course be smaller--the code takes care of that.)

-RVP



Home | Main Index | Thread Index | Old Index