summaryrefslogtreecommitdiff
blob: 07f9bad989d6aa3d11bcd542119f3bf01c10adb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
This corrupted the path for me before, so it couldn't find the file. Presumably since the glibc change to copy stuff backwards.

diff -pudr wmbiff-0.4.27/wmbiff/mboxClient.c wmbiff-0.4.27-mik/wmbiff/mboxClient.c
--- wmbiff-0.4.27/wmbiff/mboxClient.c	2004-03-28 01:28:58.000000000 +0100
+++ wmbiff-0.4.27-mik/wmbiff/mboxClient.c	2011-09-16 09:54:22.834144487 +0200
@@ -149,7 +149,10 @@ int mboxCreate(Pop3 pc, const char *str)
 			DM(pc, DEBUG_ERROR, "mbox '%s' is too long.\n", str + 5);
 			memset(pc->path, 0, BUF_BIG);
 		} else {
-			strncpy(pc->path, str + 5, BUF_BIG - 1);	/* cut off ``mbox:'' */
+      /* str is always pc.path, so we can't use strncpy */
+      int len = strlen(str + 5);
+			memmove(pc->path, str + 5, min(len, BUF_BIG - 1));	/* cut off ``mbox:'' */
+      pc->path[len] = '\0';
 		}
 	}