dockapps/wmbiff/wmbiff
Doug Torrance 3b000774cc wmbiff: Manually copy mailbox path.
Patch by Demi <m@tfiu.de> to fix Debian bug #621690.

From https://bugs.debian.org/621690:

> wmbiff change path of my mailboxes next nearest.
>
> For example wmbiff change 'gleb' to 'glil' for second and fourth mailboxes.
> However the 1st, 3rd and 5th mailboxes have correct path.

Well, the indices don't really enter.  I'm actually surprised this
isn't more trouble.

The underlying reason is that in wmbiff.c:parse_mbox_path, the
program calls

  mboxCreate((&mbox[item]), mbox[item].path);

which for maildirs calls

  int maildirCreate(Pop3 pc, const char *str)

in maildirClient.c.  str in this way is an alias for pc->path.

In maildirCreate, after some char acrobatics, the program eventually
does

  strncpy(pc->path, str + 8 + i, BUF_BIG - 1);

to cut off the leading stuff from the maildir.  The result of this
operation is not defined, as pc->path and str point to the same
memory and thus the arguments overlap, which strncpy outlaws.

A simple fix is to copy manually, like this:

		DM(pc, DEBUG_ERROR, "maildir '%s' is too long.\n", str + 8 + i);
		memset(pc->path, 0, BUF_BIG);
	} else {
+		const char *sp = str + 8 + i;
+		char *dp = pc->path;
+
+		while (*sp && sp-str<BUF_BIG-1) {
+			*dp++ = *sp++;
+		}
+		*dp = 0;
-		strncpy(pc->path, , BUF_BIG - 1);	/* cut off ``maildir:'' */
	}

-- it's what I'm doing now.  But I give you that's a bit pedestrian.
2017-06-24 17:07:02 +01:00
..
charutil.c Remove trailing whitespace. 2014-10-05 19:18:49 +01:00
charutil.h Remove trailing whitespace. 2014-10-05 19:18:49 +01:00
Client.h wmbiff: Use unsigned data type for port number. 2016-12-01 10:51:29 +00:00
gnutls-common.c wmbiff: Fix compiler warnings from deprecated gnutls types. 2014-11-08 11:20:02 +00:00
gnutls-common.h wmbiff: Fix compiler warnings from deprecated gnutls types. 2014-11-08 11:20:02 +00:00
Imap4Client.c wmbiff: Add #define _GNU_SOURCE to avoid "implicit declaration" warnings. 2016-12-01 10:51:29 +00:00
maildirClient.c wmbiff: Manually copy mailbox path. 2017-06-24 17:07:02 +01:00
Makefile.am Remove trailing whitespace. 2014-10-05 19:18:49 +01:00
mboxClient.c Remove trailing whitespace. 2014-10-05 19:18:49 +01:00
MessageList.c Strip off version numbers from dir name 2012-02-12 22:50:31 +00:00
MessageList.h Strip off version numbers from dir name 2012-02-12 22:50:31 +00:00
passwordMgr.c wmbiff: Add #define _GNU_SOURCE to avoid "implicit declaration" warnings. 2016-12-01 10:51:29 +00:00
passwordMgr.h Strip off version numbers from dir name 2012-02-12 22:50:31 +00:00
Pop3Client.c wmbiff: Use PACKAGE_BUGREPORT instead of hardcoding address. 2014-11-08 11:20:02 +00:00
regulo.c Strip off version numbers from dir name 2012-02-12 22:50:31 +00:00
regulo.h Strip off version numbers from dir name 2012-02-12 22:50:31 +00:00
sample.wmbiffrc wmbiff: Update email address. 2014-11-08 11:20:02 +00:00
ShellClient.c wmbiff: Add #define _GNU_SOURCE to avoid "implicit declaration" warnings. 2016-12-01 10:51:29 +00:00
socket.c wmbiff: Use unsigned data type for port number. 2016-12-01 10:51:29 +00:00
test_tlscomm.c Update gnutls code (require at least 2.2.0). 2013-04-08 18:03:34 +01:00
test_wmbiff.c wmbiff: Add #define _GNU_SOURCE to avoid "implicit declaration" warnings. 2016-12-01 10:51:29 +00:00
tlsComm.c wmbiff: FTBFS with initialize_gnutls 2015-08-16 11:40:20 +01:00
tlsComm.h wmbiff: Fix cast to pointer from integer of different size compiler warning. 2014-11-08 11:20:02 +00:00
wmbiff-classic-master-led.xpm Enable classic mode. 2013-04-08 18:04:30 +01:00
wmbiff-master-led.xpm Strip off version numbers from dir name 2012-02-12 22:50:31 +00:00
wmbiff.1 wmbiff: Fix typos. 2016-07-20 16:37:37 +01:00
wmbiff.c wmbiff: Fix typos. 2016-07-20 16:37:37 +01:00
wmbiffrc.5.in wmbiff: Fix manpages. 2014-11-08 11:20:02 +00:00